jpetzke / AutoGPT-YouTube

A plugin for AutoGPT that allows various operations on YouTube, such as downloading Videos
MIT License
128 stars 23 forks source link

Command search_youtube returned: Error: 'items' #7

Closed fenderrex closed 1 year ago

fenderrex commented 1 year ago

I'm not using docker and had to use nltk to download the tokenizer but still get error " Command search_youtube returned: Error: 'items'" must i use docker?

jpetzke commented 1 year ago

You do not usually need docker, it seems that the search_youtube command did not return anything. Do you have a valid API key?

fenderrex commented 1 year ago

yes, i was able to download a video but I can't search, my API key is not restricted I'm looking for the error handling code now master branch windows had to install ffmpeg with choco via choco install ffmpeg to get the download working

jpetzke commented 1 year ago

A third-party library handles the video download. Can you send me the log of AutoGPT?

fenderrex commented 1 year ago

error.log

error log 2023-04-29 03:25:43,866 ERROR logs:_log:121 Error: The following AI output couldn't be converted to a JSON:
 My apologies, I made a mistake in my previous response. Please use the "search_youtube" command to find videos related to product production and tools. Once you have found some relevant videos, you can use the "download_youtube_video" command to download them and analyze their content.

activity.log

2023-04-29 03:46:25,564 INFO  THOUGHTS: I will start by analyzing the videos I found on YouTube to identify potential items to resell and evaluate their impact on the market. I will rate how likely each idea or product is to impact the market based on comments and how trades/jobs are affected. I will use the 'get_youtube_comments' command to get some comments of a YouTube video to help me with this analysis.
2023-04-29 03:46:26,217 INFO REASONING: Analyzing the videos I found on YouTube will help me identify potential items to resell and evaluate their impact on the market. Rating how likely each idea or product is to impact the market based on comments and how trades/jobs are affected will help me prioritize which items to focus on. Using the 'get_youtube_comments' command will help me get some comments of a YouTube video to help me with this analysis.
2023-04-29 03:46:26,866 INFO PLAN: 
2023-04-29 03:46:26,934 INFO -  Analyze the videos to identify potential items to resell and evaluate their impact on the market\\n- Rate how likely each idea or product is to impact the market based on comments and how trades/jobs are affected\\n- Use the 'get_youtube_comments' command to get some comments of a YouTube video to help with the analysis
2023-04-29 03:46:27,589 INFO CRITICISM: I need to be careful not to spend too much time on any one video. I should aim to complete each step as efficiently as possible to maximize my use of the API budget.
2023-04-29 03:46:28,124 INFO NEXT ACTION:  COMMAND = get_youtube_comments  ARGUMENTS = {'url': '<video url>'}
2023-04-29 03:46:28,404 INFO SYSTEM:  Command get_youtube_comments returned: Error: list index out of range
2023-04-29 03:48:27,588 INFO  THOUGHTS: I will use the 'search_youtube' command to search for videos related to product production and tools. I will then analyze the videos to identify potential items to resell and evaluate their impact on the market. I will rate how likely each idea or product is to impact the market based on comments and how trades/jobs are affected. To help me with this analysis, I will use the 'get_youtube_comments' command to get some comments of a YouTube video.
2023-04-29 03:48:28,254 INFO REASONING: Using the 'search_youtube' command will help me find more videos related to product production and tools. Analyzing these videos will help me identify potential items to resell and evaluate their impact on the market. Rating how likely each idea or product is to impact the market based on comments and how trades/jobs are affected will help me prioritize which items to focus on. Using the 'get_youtube_comments' command will help me get some comments of a YouTube video to help me with this analysis.
2023-04-29 03:48:28,887 INFO PLAN: 
2023-04-29 03:48:28,941 INFO -  Use the 'search_youtube' command to search for videos related to product production and tools\\n- Analyze the videos to identify potential items to resell and evaluate their impact on the market\\n- Rate how likely each idea or product is to impact the market based on comments and how trades/jobs are affected\\n- Use the 'get_youtube_comments' command to get some comments of a YouTube video to help with the analysis
2023-04-29 03:48:29,623 INFO CRITICISM: I need to be careful not to spend too much time on any one video. I should aim to complete each step as efficiently as possible to maximize my use of the API budget.
2023-04-29 03:48:30,180 INFO NEXT ACTION:  COMMAND = search_youtube  ARGUMENTS = {'query': 'product production and tools'}
2023-04-29 03:48:30,621 INFO SYSTEM:  Command search_youtube returned: Error: 'items'

image

jpetzke commented 1 year ago

Okay. Please go to a terminal (cmd, powershell etc.) and execute the following command: curl "https://www.googleapis.com/youtube/v3/search?key=YOUR_API_KEY&part=snippet&maxResults=10&q=product+production+and+tools" Be sure to insert your API key for youtube

fenderrex commented 1 year ago

it returned the request with no trouble

{
  "kind": "youtube#searchListResponse",
  "etag": "4EVeDb2YTdbkQmmGvxCTOJYQrO8",
  "nextPageToken": "CAoQAA",
  "regionCode": "US",
  "pageInfo": {
    "totalResults": 1000000,
    "resultsPerPage": 10
  },
  "items": [
    {
      "kind": "youtube#searchResult",
      "etag": "Bz1FbS6MPB1Jp44mg4Zt6akZ1Kc",
      "id": {
        "kind": "youtube#video",
        "videoId": "JcBe8ZiSJWg"
      },
      "snippet": {
        "publishedAt": "2021-03-24T16:01:45Z",
        "channelId": "UCoVJEtEK7y-L7nNc7DP5V_A",
        "title": "Production Of Tools And Others Amazing Manufacturing Processes",
        "description": "Manufacturing processes are applicable in all areas of our lives, so much that we often don't realize or think about it. Because, are ...",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/JcBe8ZiSJWg/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/JcBe8ZiSJWg/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/JcBe8ZiSJWg/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "EDWIN",
        "liveBroadcastContent": "none",
        "publishTime": "2021-03-24T16:01:45Z"
      }
    },
    {
      "kind": "youtube#searchResult",
      "etag": "nnHxO44wxA2rddd8mnft3V-V6WE",
      "id": {
        "kind": "youtube#video",
        "videoId": "XhVkTWJ2OQs"
      },
      "snippet": {
        "publishedAt": "2022-05-21T13:30:14Z",
        "channelId": "UCpN4xx95-4aTpCLWOPNsuYg",
        "title": "Top 5 Product Management Tools",
        "description": "With the best product management tools you can ensure product overall success as well as improve the efficiency of product ...",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/XhVkTWJ2OQs/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/XhVkTWJ2OQs/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/XhVkTWJ2OQs/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "Be Productive",
        "liveBroadcastContent": "none",
        "publishTime": "2022-05-21T13:30:14Z"
      }
    },
    {
      "kind": "youtube#searchResult",
      "etag": "OAOApDYbAf53zF2dArne_v4df2w",
      "id": {
        "kind": "youtube#video",
        "videoId": "tuOWx0bPBNI"
      },
      "snippet": {
        "publishedAt": "2022-10-19T08:25:07Z",
        "channelId": "UCsvqVGtbbyHaMoevxPAq9Fg",
        "title": "Top 10 Product Management Tools | Product Management Tools And Techniques Explained | Simplilearn",
        "description": "Professional Certification In Product Management: ...",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/tuOWx0bPBNI/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/tuOWx0bPBNI/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/tuOWx0bPBNI/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "Simplilearn",
        "liveBroadcastContent": "none",
        "publishTime": "2022-10-19T08:25:07Z"
      }
    },
    {
      "kind": "youtube#searchResult",
      "etag": "sWvuVKsl7m5761p8cQ_s7tIbGFs",
      "id": {
        "kind": "youtube#video",
        "videoId": "XyP_7IZzpeI"
      },
      "snippet": {
        "publishedAt": "2020-07-20T13:00:16Z",
        "channelId": "UCXQ0opKNREpA62x7gMk_hZw",
        "title": "Modern Continuous Manufacturing Processes For A Next Level Of Productivity ▶ 3",
        "description": "Modern Continuous Manufacturing Processes For A Next Level Of Productivity ▷ 3 In this video: 1. How Pencils are made in ...",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/XyP_7IZzpeI/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/XyP_7IZzpeI/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/XyP_7IZzpeI/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "NaLac Technique",
        "liveBroadcastContent": "none",
        "publishTime": "2020-07-20T13:00:16Z"
      }
    },
    {
      "kind": "youtube#searchResult",
      "etag": "HuhmfAYkwEpMoYPa_4fQnhj_MO8",
      "id": {
        "kind": "youtube#video",
        "videoId": "r1PBu4dnQqI"
      },
      "snippet": {
        "publishedAt": "2022-07-29T17:22:00Z",
        "channelId": "UCvoh9uWVTzo8u3e5eX4lO5A",
        "title": "Manufacturing process of wooden thread bolt- Good tools and machinery make work easy",
        "description": "",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/r1PBu4dnQqI/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/r1PBu4dnQqI/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/r1PBu4dnQqI/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "Crafts people",
        "liveBroadcastContent": "none",
        "publishTime": "2022-07-29T17:22:00Z"
      }
    },
    {
      "kind": "youtube#searchResult",
      "etag": "E3mO_2p4hCiuBKPocf_B3HuaNSk",
      "id": {
        "kind": "youtube#video",
        "videoId": "HhzqE1YlvnI"
      },
      "snippet": {
        "publishedAt": "2020-07-04T07:30:00Z",
        "channelId": "UCXOu4YyNTiykogB88H86Dyw",
        "title": "Incredible smart tools production processing I&#39;ve never seen before. Amazing production technology",
        "description": "Incredible smart tools production processing I've never seen before. Amazing production technology. Music: Total Happy Up And ...",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/HhzqE1YlvnI/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/HhzqE1YlvnI/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/HhzqE1YlvnI/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "GlobalTech HD",
        "liveBroadcastContent": "none",
        "publishTime": "2020-07-04T07:30:00Z"
      }
    },
    {
      "kind": "youtube#searchResult",
      "etag": "amfAiMA8A5y754JjiXxJLobmjlA",
      "id": {
        "kind": "youtube#video",
        "videoId": "owBhaRafdsU"
      },
      "snippet": {
        "publishedAt": "2022-01-01T11:32:03Z",
        "channelId": "UCf3Vtm8OTBsyjJwYfmF2trw",
        "title": "Making Process of Drive Ratchet L Handle Socket Wrench Hand Tool in Factory || Amazing Production",
        "description": "L-handle wrench attachments on both ends is compact and perfect for trail packs, The design is very strong because there are no ...",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/owBhaRafdsU/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/owBhaRafdsU/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/owBhaRafdsU/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "The Mechanic",
        "liveBroadcastContent": "none",
        "publishTime": "2022-01-01T11:32:03Z"
      }
    },
    {
      "kind": "youtube#searchResult",
      "etag": "w_kRZvKwyDAu-LVYwF-HseASqIk",
      "id": {
        "kind": "youtube#video",
        "videoId": "jjp9SPyEB7k"
      },
      "snippet": {
        "publishedAt": "2021-02-07T06:39:07Z",
        "channelId": "UCXQ0opKNREpA62x7gMk_hZw",
        "title": "Amazing Production Process with Modern Machines and Skilful Workers",
        "description": "Amazing Production Process with Modern Machines and Skilful Workers In this video: 1. axial closed die rolling machine: Arvind ...",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/jjp9SPyEB7k/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/jjp9SPyEB7k/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/jjp9SPyEB7k/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "NaLac Technique",
        "liveBroadcastContent": "none",
        "publishTime": "2021-02-07T06:39:07Z"
      }
    },
    {
      "kind": "youtube#searchResult",
      "etag": "-eqREzeuO-bAA6W0fPSbuydvH3E",
      "id": {
        "kind": "youtube#video",
        "videoId": "K1ihYwpWIFw"
      },
      "snippet": {
        "publishedAt": "2022-11-25T16:00:13Z",
        "channelId": "UC9dH2O4ZcCAumwHZQ1Uly0w",
        "title": "Most Satisfying Factory Machines and Ingenious Tools | Incredible Factory Production Process",
        "description": "Most Satisfying Factory Machines and Ingenious Tools Welcome to Kool Brah, a strangely satisfying technology-based channel.",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/K1ihYwpWIFw/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/K1ihYwpWIFw/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/K1ihYwpWIFw/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "Kool Brah",
        "liveBroadcastContent": "none",
        "publishTime": "2022-11-25T16:00:13Z"
      }
    },
    {
      "kind": "youtube#searchResult",
      "etag": "Ase3HktPBtJjmKDnX5KYRZ2o5iM",
      "id": {
        "kind": "youtube#video",
        "videoId": "-H5C0fgv40o"
      },
      "snippet": {
        "publishedAt": "2022-04-01T10:00:12Z",
        "channelId": "UC5fpYR3G3T3rnV62LgxqS0g",
        "title": "Hex Nut Manufacturing | Production of Hexagon Nut Using Simple Tools",
        "description": "Hex Nut Manufacturing | Production of Hexagon Nut Using Simple Tools Subscribe to my Channel at: http://bit.ly/2GFCgxQ Follow ...",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/-H5C0fgv40o/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/-H5C0fgv40o/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/-H5C0fgv40o/hqdefault.jpg",
            "width": 480,
            "height": 360
          }
        },
        "channelTitle": "Restoration & Experiments",
        "liveBroadcastContent": "none",
        "publishTime": "2022-04-01T10:00:12Z"
      }
    }
  ]
}

The error rate dropped as the request was sent image

jpetzke commented 1 year ago

great. What branch have you downloaded and installed currently`?

fenderrex commented 1 year ago

master branch on windows had to install ffmpeg with choco via choco install ffmpeg to get the download working i resorted to installing with python.exe -m pip to ensure i was reaching the proper python package manager AutoGPT-YouTube: 0.2.0 - This is a plugin for Auto-GPT which enables access to certain YouTube features. shows loaded as i have not added it to the env file for the verbose I start it with python.exe -m autogpt

jpetzke commented 1 year ago

but there is no warning featuring a missing API-Key? Try switching to the branch youtube-api, which is currently in development but contains a lot of fixes, including a fix for this. To switch, select the branch on the code page and re-download the zip file

fenderrex commented 1 year ago

Thankyou for all the help, I got autogpt reading the videos, but i have noticed large amounts of unsupported chars encoded or unsupported in the command line from this video such asاللە اکبر ❤\n- 👍.🇦🇿\n- I take factory,\n- Good 👍 showing for you tube\n- 视频很棒 image

but it seems that it has value to the goal set so it is tokenizing foreign languages well I guess.

jpetzke commented 1 year ago

It should only be a problem displaying it. It probably handles it correctly.

DimDroll commented 1 year ago

I apologize for re-openning closed issue, but I'm using latest Auto-GPT and master branch of this repo (no other branches are available) and still get this error.

As you can see in the output of @fenderrex , it shows: 2023-04-29 03:46:28,124 INFO NEXT ACTION: COMMAND = get_youtube_comments ARGUMENTS = {'url': '<video url>'}

Same happened with me, for some reason it does not parses or get the URL that it needs to use as an argument and so the URL is empty and hence the out of the range error. For me, it happened with most of the plugin's commands.

The solution for me was to NOT to accept the command but instruct him to use the proper argument first. Like this:

I want Auto-GPT to: Using plugin AutoGPT-YouTube download and save captions from URL:
https://www.youtube.com/watch?v=ujRwf1HdNjk
Make sure to use proper URL and not '<video url>'

It failed to pick up the URL:

NEXT ACTION:  COMMAND = get_youtube_transcript ARGUMENTS = {'url': '<video url>'}

I asked him again:

Input:fix arguments, instead <video url> use https://www.youtube.com/watch?v=ujRwf1HdNjk

This time it worked:

NEXT ACTION:  COMMAND = get_youtube_transcript ARGUMENTS = {'url': 'https://www.youtube.com/watch?v=ujRwf1HdNjk'}

I was running it in docker-compose, not sure if it makes the difference as I see other folks run it raw through python locally installed.