Code Monkey home page Code Monkey logo

youtube-search-python's People

Contributors

alexandreouellet avatar alexmercerind avatar anshuman852 avatar chirag127 avatar fabi321 avatar huenique avatar jwadow avatar maple-elter avatar mytja avatar raitonoberu avatar rking32 avatar zocker1999net avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtube-search-python's Issues

Number of views is not correct

Thanks for the great library. Nevertheless when I do a search on: "Madonna Hung Up" I get these results:

{'channel': 'Madonna',
 'duration': '5:27',
 'id': 'EDwb9jOVRtU',
 'index': 0,
 'link': 'https://www.youtube.com/watch?v=EDwb9jOVRtU',
 'thumbnails': ['https://img.youtube.com/vi/EDwb9jOVRtU/default.jpg',
                'https://img.youtube.com/vi/EDwb9jOVRtU/hqdefault.jpg',
                'https://img.youtube.com/vi/EDwb9jOVRtU/mqdefault.jpg',
                'https://img.youtube.com/vi/EDwb9jOVRtU/sddefault.jpg',
                'https://img.youtube.com/vi/EDwb9jOVRtU/maxresdefault.jpg'],
 'title': 'Madonna - Hung Up (Official Music Video)',
 'views': 268}

It seems like the number of views (269 036 248) isn't parsed correctly. Seems like this line could be the culprit:
https://github.com/alexmercerind/youtube-search-python/blob/cdfd4ff16ef45a00c448983586b4fcc7cd8ef123/youtubesearchpython/videos__scripthandler.py
for character in self.pageSource[index+2].split()[0]:

Duration filter

Is there any way to get results with duration filter.

Youtube on its page has a duration filter with short (<4mins) and a long(>20mins) things.

image

It will be really helpful if you can add this in case this is not available.

Bad title

There are the date of the video, the channel name and the number of views in the title of each video.

{
    "search_result": [
        {
            "index": 0,
            "id": "RQ5IkSeMQbc",
            "link": "https://www.youtube.com/watch?v=RQ5IkSeMQbc",
            "title": "Teyeq - Demons [NCS Release] de NoCopyrightSounds il y a 22 heures 2 minutes et 35 secondes 238 806 vues\"",
            "channel": "",
            "duration": "",
            "views": 806,
            "thumbnails": [
                "https://img.youtube.com/vi/RQ5IkSeMQbc/default.jpg",
                "https://img.youtube.com/vi/RQ5IkSeMQbc/hqdefault.jpg",
                "https://img.youtube.com/vi/RQ5IkSeMQbc/mqdefault.jpg",
                "https://img.youtube.com/vi/RQ5IkSeMQbc/sddefault.jpg",
                "https://img.youtube.com/vi/RQ5IkSeMQbc/maxresdefault.jpg"
            ]
        },...

The title is : Teyeq - Demons [NCS Release] de NoCopyrightSounds il y a 22 heures 2 minutes et 35 secondes 238 806 vues
(Teyeq - Demons [NCS Release] de NoCopyrightSounds il y a 22 heures 2 minutes et 35 secondes 238 806 vues means Teyeq - Demons [NCS Release] from NoCopyrightSounds 22 hours, 2 minutes and 35 seconds ago 238806 vues in french.)
I don't understand why there are the date of the video, the channel name and the number of views in the title of each video.

Also there is nothing in the field channel

I checked in youtude source code and the title is correct but the label isn't.

{"url":"https://i.ytimg.com/vi/rLe5S1UKPko/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==\u0026rs=AOn4CLDCBddTGwin1yccKbIbyasMJC4qkg","width":336,"height":188}]},
"title":{"runs":[{"text":"Meryl - Coucou"}],"accessibility":{"accessibilityData":{"label":"**Meryl - Coucou de Meryl270 il y a 4 mois 2 minutes et 39 secondes 4β€―019β€―653 vues**"}}}

Pyinstaller making youtube-search-python unusable

So i have this line of code in one of my cogs in my discord.py bot that works perfectly fine normally but when i make it an exe it gives me this error:

Traceback (most recent call last): File "discord\ext\commands\core.py", line 85, in wrapped File "C:\Users\FIREPL~1\AppData\Local\Temp\_MEI99962\cogs\music.py", line 446, in _play search = VideosSearch(search, limit=1).result()['result'][0]['link'] File "youtubesearchpython\search.py", line 142, in __init__ File "youtubesearchpython\internal\search.py", line 20, in __init__ File "youtubesearchpython\handlers\requesthandler.py", line 12, in __makeRequest FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\FIREPL~1\\AppData\\Local\\Temp\\_MEI99962\\youtubesearchpython\\requestPayload.json'

Is there any way to fix this error?

Only link output

Hey, the module is working but i wanna ask how can i get only link to the video in output, and its possible to get it to string for use in other code?

Return None

Hi,

When I tried to run example project I am getting the None error.
Please can you check it?

Thanks

Do you can set title with Unicode

Hello
With title is Vietnamese, Chinese, Japanese --> title output is not support utf8 unicode right now.
so you can add this in next version please. Thank you so much

Python 2 support issue

Hello!
Tried to import your library with
pip install youtube-search-python
but, when I import it from Python 2, I get this error, which I don't get, if I manually add this library into my project folder:

Traceback (most recent call last):
  File "F:\MyAssistantOS\recognition\my.py", line 15, in <module>
    from youtubesearchpython import searchYoutube
  File "C:\Python27\lib\site-packages\youtubesearchpython\__init__.py", line 1, in <module>
    from youtubesearchpython.videos__search import SearchVideos
  File "C:\Python27\lib\site-packages\youtubesearchpython\videos__search.py", line 3, in <module>
    from youtubesearchpython.__requesthandler import requesthandler
  File "C:\Python27\lib\site-packages\youtubesearchpython\__requesthandler.py", line 2, in <module>
    from urllib.request import urlopen
ImportError: No module named request

Can you fix this?
Thank you

Playlist search: index out of range

Thanks for the new Playlist Search feature, it is awesome!

When I search for Playlits called "drum and bass" I run into an error:

>>> search = SearchPlaylists("drum and bass", offset = 1, mode = "dict", max_results = 20).result()

~/.local/lib/python3.8/site-packages/youtubesearchpython/playlist__search.py in result(self)
     63                         "id": self.ids[index],
     64                         "link": self.links[index],
---> 65                         "title": self.titles[index],
     66                     }
     67                     result+=[result_index]

IndexError: list index out of range

Apparently search.ids and search.links have 21 entries, while search.titles only has 20.

Default Language

Question: Do you think it might be useful to set a default language for the search url?
At the moment I am traveling abroad and the information like uploaded x months ago is in cyrillic letters what unfortunately I am barely able to read.

So in my specific case it would be useful if the script would use english as a default language.
At the same time I can see that probably others like the fact that the script is using their local language.

To be honest I am not clear what could be a easy and nice solution in this case...

Advice

Hello sir try to add search via id. So that we can get the data from YouTube link too. Thank you sir

SearchVideos & SearchPlaylists's result() method gives None return.

If you are getting None as a return value after calling result() on the object of SearchVideos or SearchPlaylists class, it can mean any of the following things:

  1. Module has encountered a network error.
  2. You are using an older version of module (which might be unable to fetch data from YouTube's updated website).

In your problem doesn't seem to lie in any of the two cases above, feel free to open issue about this.

If you attach log.txt generated by running following script, it will be really helpful for me to deal with your issue.

from youtubesearchpython import SearchVideos
if __name__ == '__main__':
    videos = SearchVideos('NoCopyrightSounds')
    with open('log.txt', 'a', encoding = 'utf_8') as file:
        if (videos.result() == None):
            print('alexmercerind/youtube-search-python failed.')
            fields = vars(videos)
            for key in fields:
                file.write(f'\n==========self.{key}==========\n')
                file.write(str(fields[key]))
            print('Debugging log saved in log.txt.')
        else:
            print('alexmercerind/youtube-search-python worked properly.')

Thankyou πŸ€

Support for Python 2

Hello!
I'm working on a project that would need your library since YouTube is making a lot of changes this month, which caused non working of my code. Saw same issue with your code a couple of days ago (#16 ) but you resolved it.
However this library is designed for Python 3. Is it somehow possible to integrate Python 2 into your library. If not, i will move my project to Python 3, since I want to do it for quite of while and this would be a big plus for movement.
Project site: https://github.com/mytja/MyAssistantOS-Raspbian
Thank you so much
mytja

Something wrong in class RequestHandler(ComponentHandler):

class RequestHandler(ComponentHandler):
    def __makeRequest(self, requestBody = requestPayload) -> None:
        requestBody['query'] = self.query
        requestBody['client'] = {
            'hl': self.language,
            'gl': self.region,
        }

This method is had problem that requestPayload is change if requestBody is change so if you call VideosSearch("something") twice it causes error because requsestPayload is change (requestBody['continuation'] is already exist even not start searching!)
i think should rewrite code

import copy

class RequestHandler(ComponentHandler):
    def __makeRequest(self, requestBody = None) -> None:
        if requestBody == None:
            requestBody = copy.deepcopy(requestPayload)
        requestBody['query'] = self.query
        requestBody['client'] = {
            'hl': self.language,
            'gl': self.region,
        }
from youtubesearchpython.search import VideosSearch

videos = VideosSearch("something")
videos2 = VideosSearch("something2") <---- Error

Could not parse YouTube response

Something broke between 1.3.3 and 1.3.6, at least in CustomSearch(), nearly every results returns 0 results or throws a "Could not parse YouTube response." in 1.3.6. What makes no sense is why some keywords work, but most fail. Forgive the language but I was pulling my hair out and just started throwing words at it, with a bit of trial and error I found two words that either always worked or always failed. On 1.3.6 searching with CustomSearch() with the search param "CAASBAgBEAE", "music" currently returns 48 results but "fuck" returns 0 results, on 1.3.3 with the exact same code "fuck" returns 48 results.

The code is a bit to granular for me to trace it back quickly. but I would guess something from commit 4c731bb is to blame as _youtubesearchpython/handlers/requesthandler.py -> _parseSource() is throwing the exception.

Terms of service abuse (This library does not do it)

Citing the terms of service available here: https://www.youtube.com/static?gl=GB&template=terms

Permissions and Restrictions

You may access and use the Service as made available to you, as long as you comply with this Agreement and the law. You may view or listen to Content for your personal, non-commercial use. You may also show YouTube videos through the embeddable YouTube player.

The following restrictions apply to your use of the Service. You are not allowed to:

[...]

access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

The project advertise itself as a library to "search videos in YouTube WITHOUT using YouTube Data API v3." and is indeed a scrapper of the youtube web interface. This is a clear abuse of the terms cited above and prevent your library from working in various controlled environment.

The problematic code is as follow:

request = "https://www.youtube.com/results?search_query=%s&page=%d" %(self.keyword, self.offset)
#########Making Network Request#########
self.page = urllib.request.urlopen(request).read().decode('utf_8')

How to run asyns downloads?

I'm trying run this code for download other search pages:

import asyncio
from youtubesearchpython.__future__ import VideosSearch
search = VideosSearch('NoCopyrightSounds')

result = await search.next()
print(result['result'])

result = await search.next()
print(result['result'])

result = await search.next()
print(result['result'])

result = await search.next()
print(result['result'])

But getting this error:

  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pc/.vscode/extensions/ms-python.python-2021.2.636928669/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
    cli.main()
  File "/home/pc/.vscode/extensions/ms-python.python-2021.2.636928669/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main
    run()
  File "/home/pc/.vscode/extensions/ms-python.python-2021.2.636928669/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 285, in run_file
    runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
  File "/usr/lib/python3.6/runpy.py", line 261, in run_path
    code, fname = _get_code_from_file(run_name, path_name)
  File "/usr/lib/python3.6/runpy.py", line 236, in _get_code_from_file
    code = compile(f.read(), fname, 'exec')
  File "/home/pc/Projects/DatasetFetch/new_scripts.py", line 116
    videosResult = await videosSearch.next()
                                    ^
SyntaxError: invalid syntax

What I'm doing not right?

Safesearch

Hello, is there a way that I can use safesearch with this?

None Results

test.py

from youtubesearchpython import SearchVideos

search = SearchVideos("NoCopyrightSounds", offset=1, mode="json", max_results=20)

print(search.result())

terminal

python .\test.py
None

Max_results and page

Nice solution, but Iβ€˜ve got two issues (with v1.2.4)

  1. Tried to change max_results to >20 , but always getting only 20 results.
  2. I can only use page=1. With 2 or something else, I donβ€˜t get a result - but there is more than one page availble when using the url in my browser

Support for finding Playlists

Hey, first of all, thanks your module works great and it does the job.

Would it be possible to add support for finding for playlists (links) on Youtube?

And maybe add an option so you can define what kind of search results should be included (normal video, livestream, playlist).

Right now I just search for the video and then see if duration = "LIVE" or not, to determine this, but it would be cool if you have a built in function.

Best regards.

Making the requests async?

Wonder if the RequestHandler could be made async by using something like aiohttp instead of urllib.requests? I'm using this package in some app and I would like to do stuff like make more requests while I'm waiting for the response of the first request.

How can i go directly to a specific search page?

Please tell me how you can go directly to a specific search page? For example, if I have already downloaded 200 videos, how can I immediately start downloading with 201 videos for a specific search term?

More options ? order by time ? limit time?in one month?

search = SearchVideos(kw, offset = 1, mode = "json", max_results = 10)
self.searchPreferences = "EgIQAQ%3D%3D"

searchPreferences cann't be fixed
should add to parameters
then I don't need to change source code

Thank you

Usage of "offset" parameter

Hello, @alexmercerind ! Nice work!

I have a question about the "offset" param, which is used for the initialization of SearchVideos and SearchPlaylists objects. I have not found its usage in any of the submodules of the package "youtubesearchpython".

Is this param used somewhere?

How to get playlist information using link?

Hello! I'm excited with your project, because it really simple, quickly and powerful, but i found a small bug. I think when playlist's ID includes underscore or dash then PlaylistsSearch doesn't work properly.
For example: when i try to find this playlist:
'https://www.youtube.com/playlist?list=PLrxcNWZXdQ2nRZvJcLoQpJhUBrPVOBbll' - it works perfectly, but when i try find this one:
'https://youtube.com/playlist?list=OLAK5uy_nHcJWdK2mi8vKVRco3MfQuH12938KF-hQ' or
'https://www.youtube.com/playlist?list=OLAK5uy_mRdEfaPOzXui_tyud3VE_vAHDqCiPOyDw' - i have no results =(

Can you fix it PLEASE ?)

Include upload date in search results? (enhancement)

Hi,
I love your search script and have an enhancement request:
Could you include the upload date from the search results into the query?
Where it says 1 year ago, 3 months ago etc.?
I hope this would not be too much difficulties and it would be a great enhancement for me :-)

Trying to import Request from ullib breaks lib for Python 2

Using python 2, I get this for version 1.3.2. Version 1.3.1 works just fine.

pi@basiliscus:~ $ python /opt/tboplayer/tboplayer.py
Traceback (most recent call last):
File "/opt/tboplayer/tboplayer.py", line 75, in
from youtubesearchpython import SearchVideos
File "/home/pi/.local/lib/python2.7/site-packages/youtubesearchpython/init.py", line 1, in
from youtubesearchpython.videos__search import SearchVideos
File "/home/pi/.local/lib/python2.7/site-packages/youtubesearchpython/videos__search.py", line 3, in
from youtubesearchpython.__requesthandler import RequestHandler
File "/home/pi/.local/lib/python2.7/site-packages/youtubesearchpython/__requesthandler.py", line 4, in
from urllib import urlencode, urlopen, Request
ImportError: cannot import name Request

YouTube removed the page parameter

Hello,

i have noticed that the page parameter isn't working as intended. Minimal example to reproduce:

from youtubesearchpython import CustomSearch

first = CustomSearch('test', searchPreferences="CAM%253D", page=1)
second = CustomSearch('test', searchPreferences="CAM%253D", page=2)

print(first.result() == second.result()) # returns true

The searchPreferences are set to order the results by their respective view count.

I have manually tested the page parameter and it seems like that YouTube has disabled this functionality in order to make you use the official API. I really do not want to use their API as this requires an account. Are you aware of a method to obtain more than 20 search results without using their API?

The only method I found involves Selenium which basically just scrolls down the page to load more results.

Location and Region Ignored

search = SearchVideos("Test", offset = 1, mode = "json", max_results = 20, language="en-US", region="US")

Example video title on search results:
"title": "\u041a\u0430\u043a \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0422\u0412 IPTV \u0411\u0415\u0421\u041f\u041b\u0410\u0422\u041d\u041e : \u0422\u0412 \u043a\u0430\u043d\u0430\u043b\u044b \u043d\u0430 \u0410\u043d\u0434\u0440\u043e\u0438\u0434",

I'm getting results based on my location not on language and region arguments, which are being ignored.
Is there a way to force results in the specified language and region without having to rely on a vpn/proxy?
Thank you.

Getting more then 100 video results with Playlist.get()

It appears that their isn't yet a Playlist.get().next() or equivalent implemented. Is their a way to get more then 100 video results yet? If not is this a feature that is planned to be implemented in the future?

Also, thank you for creating/maintaining this wonderful library! I appreciate all your hard work. Have a great day!

Add channel id in the results

It would be great if the channel id was included in the search results. I don't know how this works on youtube, but an example is this:

https://www.youtube.com/watch?v=EDwb9jOVRtU

From the source:
<a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/channel/UC81VD6eeuLLSfyY_D-N8sVw" dir="auto">Madonna</a>

Channel: UC81VD6eeuLLSfyY_D-N8sVw

Quota Limit Reached?

Hi, I'm new at Github and Python. I'm using this module to stream music and deploy it on my LINE Bot. So, I found out that when I input the keyword quickly, the bot would show me "Could not make request". However, when I try it on my IDLE console, the code would run well eventhough I input it quickly. Is there a bug or is it just the error in my code? Any help will be appriciated.

Screenshot the log from my server (replit.com)
635150

Screenshot error log from my bot
image
image
image

My code:
image

My IDLE:
image

StreamURLFetcher failing for age restricted videos

(Sync version)

When i use this :

fetcher = StreamURLFetcher()
video = Video.get(link)
self.streamUrl = fetcher.get(video, 251)

If the link is this : https://www.youtube.com/watch?v=SbRNyT8my_Y

Fatal Python error: Cannot recover from stack overflow.

Thread 0xacf0d460 (most recent call first):
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 78 in _worker
  File "/usr/lib/python3.7/threading.py", line 865 in run
  File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0xad70e460 (most recent call first):
  File "/home/pi/.local/lib/python3.7/site-packages/discord/opus.py", line 339 in encode
  File "/home/pi/.local/lib/python3.7/site-packages/discord/voice_client.py", line 633 in send_audio_packet
  File "/home/pi/.local/lib/python3.7/site-packages/discord/player.py", line 596 in _do_run
  File "/home/pi/.local/lib/python3.7/site-packages/discord/player.py", line 603 in run
  File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0xae6ff460 (most recent call first):
  File "/usr/lib/python3.7/threading.py", line 300 in wait
  File "/usr/lib/python3.7/threading.py", line 552 in wait
  File "/home/pi/.local/lib/python3.7/site-packages/discord/gateway.py", line 133 in run
  File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0xaf0ff460 (most recent call first):
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 78 in _worker
  File "/usr/lib/python3.7/threading.py", line 865 in run
  File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0xafaff460 (most recent call first):
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 78 in _worker
  File "/usr/lib/python3.7/threading.py", line 865 in run
  File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0xb04ff460 (most recent call first):
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 78 in _worker
  File "/usr/lib/python3.7/threading.py", line 865 in run
  File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0xb0eff460 (most recent call first):
  File "/usr/lib/python3.7/threading.py", line 300 in wait
  File "/usr/lib/python3.7/threading.py", line 552 in wait
  File "/home/pi/.local/lib/python3.7/site-packages/discord/gateway.py", line 133 in run
  File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0xb18ff460 (most recent call first):
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 78 in _worker
  File "/usr/lib/python3.7/threading.py", line 865 in run
  File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap

Thread 0xb22fb460 (most recent call first):
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 78 in _worker
  File "/usr/lib/python3.7/threading.py", line 865 in run
  File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap

Current thread 0xb6fbbad0 (most recent call first):
  File "/home/pi/.local/lib/python3.7/site-packages/pytube/extract.py", line 425 in apply_descrambler
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 73 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  File "/home/pi/.local/lib/python3.7/site-packages/youtubesearchpython/internal/streamurlfetcher.py", line 81 in _decipher
  ...
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:1: Broken pipe

StreamURLFetcher not working

OS: Windows 10
kivy: 2.0 stable
youtube-search-python: 1.4.1
pyTube: 10.5.1

I'm trying to get Youtube stream urls using StreamURLFetcher.

    def stream_test(self):
        link = 'https://www.youtube.com/watch?v=YQHsXMglC9A'
        fetcher = StreamURLFetcher()
        stream = Video.get(link)
        url = fetcher.getAll(stream)
        print('URLS:', url)

This is the result:

URLS: <coroutine object StreamURLFetcher.getAll at 0x0E1C4930>
 <string>:112: RuntimeWarning: coroutine 'StreamURLFetcher.getAll' was never awaited
 RuntimeWarning: Enable tracemalloc to get the object allocation traceback
 <string>:112: RuntimeWarning: coroutine 'Video.get' was never awaited
 RuntimeWarning: Enable tracemalloc to get the object allocation traceback

The same happens using the example in the README (using get instead of getAll)

def stream_test(self):
    fetcher = StreamURLFetcher()
    video = Video.get("https://www.youtube.com/watch?v=aqz-KE-bpKQ")
    url = fetcher.get(video, 251)
    print(url)

the result is the same:

<coroutine object StreamURLFetcher.get at 0x0E7B38E8>
 <string>:112: RuntimeWarning: coroutine 'StreamURLFetcher.get' was never awaited
 RuntimeWarning: Enable tracemalloc to get the object allocation traceback
 <string>:112: RuntimeWarning: coroutine 'Video.get' was never awaited
 RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Any idea?
Thanks

Quotes are probably not handled correctly

On a search like this "The Honeydrips The Strangest Dream" I get these results:

{'channel': 'TheTearissiraeTehT',
 'duration': '2:37',
 'id': 'IB0paTtj6Vw',
 'index': 0,
 'link': 'https://www.youtube.com/watch?v=IB0paTtj6Vw',
 'thumbnails': ['https://img.youtube.com/vi/IB0paTtj6Vw/default.jpg',
                'https://img.youtube.com/vi/IB0paTtj6Vw/hqdefault.jpg',
                'https://img.youtube.com/vi/IB0paTtj6Vw/mqdefault.jpg',
                'https://img.youtube.com/vi/IB0paTtj6Vw/sddefault.jpg',
                'https://img.youtube.com/vi/IB0paTtj6Vw/maxresdefault.jpg'],
 'title': 'The Honeydrips - \\',
 'views': 634}

The title ("The Honeydrips - \") seems to have some problems with the quotes in the actual title: 'The Honeydrips - "The Strangest Dream"'

Download playlist

how to download or get video url from youtube url playlist with this module ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.