question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Weird empty result response

See original GitHub issue

On Python 3.7

>>> serp = 'asereje'
>>> YoutubeSearch(serp, max_results=1).to_dict()
[{'title': 'Las Ketchup - The Ketchup Song (Asereje) (Spanish Version) (Official Video)', 'link': '/watch?v=V0PisGe66mY', 'id': 'V0PisGe66mY'}]
>>> YoutubeSearch(serp, max_results=1).to_dict()
[]
>>> YoutubeSearch(serp, max_results=1).to_dict()
[{'title': 'Las Ketchup - The Ketchup Song (Asereje) (Spanish Version) (Official Video)', 'link': '/watch?v=V0PisGe66mY', 'id': 'V0PisGe66mY'}]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
alexmercerindcommented, Jul 2, 2020

Now YouTube randomly returns two types of responses, one within JavaScript and other as HTML… Now we cannot scrape using BeautifulSoup.

I have separately written another script here completely from scratch (without any third party library) and is working with both types of responses.

Feel free to use: https://github.com/alexmercerind/youtube-search-python

It has lot more information in its search result.

1reaction
andrscyvcommented, Jun 30, 2020

Hey guys, I’ve had the same issues and tried a new approach (no web scrapping ) on the script I was working on . Right now it is working, you can check it here https://github.com/andrscyv/fast_youtube_search

I got the endpoint that youtube uses to load the results of a search, it’s actually the same url but it needs other headers. It returns json but with a very weird structure although it is possible to recover the results from it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Empty Response even when the Questions are set with ...
I have chosen 'Forced response' for one question but the respondents are able to skip it. I am not sure that I have...
Read more >
android - Retrofit & Mochi: Empty response (and weird bug)
In onResponse(), the response code is always equal to 0 (default value for Int) and data is always null. BUT, now the fun...
Read more >
Any reason why this endpoint could be returning randomly an ...
Hello,. I am using in an app this library https://www.npmjs.com/package/@typeform/embed so once the user fills the form, I get the response ...
Read more >
Response with empty body - is this a problem? - jQuery Forum
I call an API on the server side to tell the server that I don't have any body in response. The server replies...
Read more >
How to troubleshoot connectivity when curl gets an *empty ...
So, I understand that an empty response means that curl didn't get any response from the server. No problem, that's precisely what I'm ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found