geekcomputers / geekcomputers/Python
When a run the youtube.py error occurred
Open
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 && __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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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