采集网站的时候,遇到返回的内容源码是乱码一样的样子怎么解决?

Black 采集 9 次浏览 采集网站的时候,遇到返回的内容源码是乱码一样的样子怎么解决?已关闭评论

答案是很大可能是json格式的源码,
进入:
http://www.jsons.cn/jsoncheck/
点击格式化,即可格式分明地看清楚源码结构。
例如:

{"slug":"avril","name":"Avril","homepage":"https:\/\/wordpress.org\/themes\/avril\/"},"requires":false,"requires_php":"5.6"},{"name":"Laboratory Pharmacy Store","slug":"laboratory-pharmacy-store","version":"1.1","preview_url":"https:\/\/wp-themes.com\/laboratory-pharmacy-store\/","author":{"user_nicename":"themespride","profile":"https:\/\/profiles.wordpress.org\/themespride\/","avatar":"https:\/\/secure.gravatar.com\/avatar\/b98c7c95393e710da933585a2018bb3c?s=96&d=monsterid&r=g","display_name":"themespride","author":"ThemesPride","author_url":"https:\/\/www.themespride.com\/"},"screenshot_url":"\/\/ts.w.org\/wp-content\/themes\/laboratory-pharmacy-store\/screenshot.png?ver=1.1","theme_url":"https:\/\/www.themespride.com\/themes\/free-laboratory-wordpress-theme\/","rating":0,"num_ratings":0,"homepage":"https:\/\/wordpress.org\/themes\/laboratory-pharmacy-store\/","description":"Laboratory Pharmacy Store is a fine theme for WordPress useful for creating websites for online drug stores, medical pharmacies, pharmaceutical companies, pharmacy shops, medical stores, medical equipment suppliers, hospital supplies, and more. It is elegant in design and makes use of minimal style so that you will get a highly sophisticated design that focuses entirely on various medical and pharmaceutical products that you sell. As it has a clean layout, users will have an easy time looking for the relevant medical products they are looking to buy. Its highly responsive and retina-ready design will play a vital role in making your website work incredibly well on laptops, desktops, tablets as well as smartphones. With a professional appeal, it is able to get all the attention of the potential audience. This free theme has many interesting elements including several actions such as Team, Blog, and more along with an enticing Banner. Call to Action Buttons (CTA) are going to take care of the interactive part and conversions as well. SEO-friendly codes are going to have a great effect on the traffic coming to your website since you will get easily noticed on the search engines. This Bootstrap-based theme also has many translation options available.","template":"online-pharmacy","parent":{"slug":"online-pharmacy","name":"Online Pharmacy","homepage":"https:\/\/wordpress.org\/themes\/online-pharmacy\/"},"requires":false,"requires_php":"5.6"}]}

格式化后是:

{
    "info": {
        "page": 5, 
        "pages": 821, 
        "results": 9841
    }, 
    "themes": [
        {
            "name": "Gutenify Photography", 
            "slug": "gutenify-photography", 
            "version": "1.0.2", 
            "preview_url": "https://wp-themes.com/gutenify-photography/", 
            "author": {
                "user_nicename": "gutenifydev", 
                "profile": "https://profiles.wordpress.org/gutenifydev/", 
                "avatar": "https://secure.gravatar.com/avatar/83451ac42816a00ccf809e68f6d6b0f8?s=96&d=monsterid&r=g", 
                "display_name": "Gutenify Dev", 
                "author": "Gutenify", 
                "author_url": "https://gutenify.com"
            }, 
            "screenshot_url": "//ts.w.org/wp-content/themes/gutenify-photography/screenshot.png?ver=1.0.2", 
            "theme_url": "https://gutenify.com/themes/gutenify-photography", 
            "rating": 0, 
            "num_ratings": 0, 
            "homepage": "https://wordpress.org/themes/gutenify-photography/", 
            "description": "Gutenify Photography is modern block-based theme where you can build your own unique looking photography website by using WordPress Blocks Editor. Gutenify Photography is a multipurpose block based free theme, the theme is built in accordance of Full Site Editing features introduced in WordPress 5.9, which means that all the aspects including colors, typography, and the layout of every single page on your site can be customized to suit your need.", 
            "requires": "5.9", 
            "requires_php": "5.6"
        }, 
        {
            "name": "Travel Trail", 
            "slug": "travel-trail", 
            "version": "1.0.1", 
            "preview_url": "https://wp-themes.com/travel-trail/", 
            "author": {
                "user_nicename": "raratheme", 
                "profile": "https://profiles.wordpress.org/raratheme/", 
                "avatar": "https://secure.gravatar.com/avatar/1a811ef619390455ed4b8fc503484ed3?s=96&d=monsterid&r=g", 
                "display_name": "Rara Theme", 
                "author": "Rara Theme", 
                "author_url": "https://rarathemes.com/"
            }, 
            "screenshot_url": "//ts.w.org/wp-content/themes/travel-trail/screenshot.png?ver=1.0.1", 
            "theme_url": "https://rarathemes.com/wordpress-themes/travel-trail/", 
            "rating": 0, 
            "num_ratings": 0, 
            "homepage": "https://wordpress.org/themes/travel-trail/", 
            "description": "Travel Trail is a feature-rich and easy-to-use WordPress travel blog theme for professional bloggers. You can easily create a visually appealing and eye-catching site to share your travel expertise, launch your fashion or lifestyle blog, share food recipes, create beauty and makeup sites, or any other niche blog. The theme is mobile-friendly, SEO optimized, Schema friendly, and loads faster to help you rank your website higher on search engines. You can easily choose from unlimited colors and 1000+ Google fonts to change your website look and feel with a single click. This theme comes with a gorgeous newsletter section that can help you generate more leads and an Instagram section to flaunt your Instagram posts. Travel Trail is translation-ready, WooCommerce and RTL compatible. Check demo at https://rarathemes.com/previews/?theme=travel-trail, read the documentation at https://docs.rarathemes.com/docs/travel-trail/, and get support at https://rarathemes.com/support-ticket/.", 
            "template": "travelbee", 
            "parent": {
                "slug": "travelbee", 
                "name": "Travelbee", 
                "homepage": "https://wordpress.org/themes/travelbee/"
            }, 
            "requires": "4.7", 
            "requires_php": "5.6"
        }, 
............
Go