geekcomputers / geekcomputers/Python

When a run the youtube.py error occurred

Open
#360 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
35.4k
Forks
12.9k
Avg merge
2h 37m
Merged PRs (30d)
1

Description

Here's the result

Young:Desktop Young$ python youtube.py 
Enter the song to be played: Hello
<div class="yt-thumb video-thumb"><span class="yt-thumb-simple">
<img alt="" data-ytimg="1" height="138" onload=";window.__ytRIL &amp;&amp; __ytRIL(this)" src="//i1.ytimg.com/vi/HeLjGn8OLnU/mqdefault.jpg" width="246"/>
<span aria-hidden="true" class="video-time">3:59</span></span></div>
Traceback (most recent call last):
  File "youtube.py", line 29, in <module>
    link = song['href']
  File "/Users/Young/anaconda3/lib/python3.6/site-packages/bs4/element.py", line 1011, in __getitem__
    return self.attrs[key]
KeyError: 'href'

It seems the youtube has change the result structure and don't have a 'href' anymore

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with youtube.py line 29 and reproduce the command shown in the report using the song search prompt. Inspect the returned YouTube result structure around the reported missing href, then verify that the script completes without the KeyError for the same input.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.