JuanBindez / pytubefix

Python3 library for downloading YouTube Videos.
http://pytubefix.rtfd.io/
MIT License
454 stars 67 forks source link

how to search something #162

Closed Morteza820 closed 1 month ago

Morteza820 commented 1 month ago

i want to search something in youtube and upload in telegram how?

i searched and received this : [, , , , , , , , , , , , , , , , , , , ]

daemosity commented 1 month ago

Hi @Morteza820!

I'm not part of the pytubefix team, but saw your issue and wanted to offer some thoughts that could help you on your journey:

The issue described above shows output from using pytubefix's Search and displaying the results, similar to the following code:

from pytubefix import Search

# Search for something on YouTube
s = Search("Github Issue Best Practices")

# Display the captured results
s.results

# output: a List of pytubefix.YouTube objects and their videoIds
#
# [<pytubefix.main.YouTube object: videoId=dbjPnXaacAU> ...
# ... <pytubefix.main.YouTube object: videoId=qQFkur0FGWg>]

You can do a number of things with each YouTube object by either iterating through the list or using a map function, but it doesn't appear as though this issue is actually a bug.

If you're encountering an error or are receiving output different from what the library documentation describes, the best way to help the dev team resolve your bug is to give as much information as you can to help them understand what went wrong. A great way to do this is:

If the issue you're having is how to use the library to accomplish a task/goal you have in mind, searching for similar questions on stackoverflow and google can be helpful. If you can't find a similar question there, submitting your question on stackoverflow with appropriate tags (and with as much information as possible re: your intent, your code stripped of all personal information, your encountered outcome, and your desired outcome) will be your best bet for accomplishing your goal.

Good luck, and have fun with your project!

JuanBindez commented 1 month ago

complementing what @daemosity said, pytubefix is ​​a library that returns values ​​from lists for example or strings, this means that if the library returns this type of data you need to treat them to be able to do what you want, that is, the library does not will do everything, it offers you an API so you can do whatever you want with the data

JuanBindez commented 1 month ago

example:

>>> from pytubefix import Search
>>> 
>>> results = Search('Github Issue Best Practices')
>>> 
>>> for video in results.videos:
...     print(f'Title: {video.title}')
...     print(f'URL: {video.watch_url}')
...     print(f'Duration: {video.length} seg')
...     print('---')
... 
Title: Good Practices with GitHub Issues
URL: https://youtube.com/watch?v=v1AeHaopAYE
Duration: 406 seg
---
Title: GitHub Issues Tips and Guidelines
URL: https://youtube.com/watch?v=kezinXSoV5A
Duration: 852 seg
---
Title: 13 Advanced (but useful) Git Techniques and Shortcuts
URL: https://youtube.com/watch?v=ecK3EnyGD8o
Duration: 486 seg
---
Title: Managing a GitHub Organization Tools, Tips, and Best Practices - Mark Matyas
URL: https://youtube.com/watch?v=1T4HAPBFbb0
Duration: 1525 seg
---
Title: Do you know the best way to manage GitHub Issues?
URL: https://youtube.com/watch?v=OccRyzAS4Vc
Duration: 534 seg
---
Title: Git Best Practices - I Wish I Would Learn Them Sooner
URL: https://youtube.com/watch?v=ThiINH4DV6Q
Duration: 610 seg
---
Title: How to Use GitHub Issues and Milestones to Plan a Project
URL: https://youtube.com/watch?v=0Cab2islg0A
Duration: 1243 seg
---
Title: Level up your GitHub Issues
URL: https://youtube.com/watch?v=hNs5Gg_fEEs
Duration: 499 seg
---
Title: Git and GitHub Tutorials #5 - Understanding GitHub Issues
URL: https://youtube.com/watch?v=TKJ4RdhyB5Y
Duration: 397 seg
---
Title: AVOID THESE! - Follow The Quartz NET Listener Best Practices
URL: https://youtube.com/watch?v=e7U56HiZ67s
Duration: 756 seg
---
Title: GitHub Crash Course Responding to Code Reviews
URL: https://youtube.com/watch?v=vSsUO_OP-f8
Duration: 320 seg
---
Title: Contributing to Open Source Can Change Your Life - Here’s How to Do It
URL: https://youtube.com/watch?v=CML6vfKjQss
Duration: 197 seg
---
Title: Git for Professionals Tutorial - Tools & Concepts for Mastering Version Control with Git
URL: https://youtube.com/watch?v=Uszj_k0DGsg
Duration: 2442 seg
---
Title: 10 GitHub Best Practices for repository management
URL: https://youtube.com/watch?v=VvgoOgWFiZY
Duration: 599 seg
---
Title: Why are you being such a git about it? - Git Best Practices
URL: https://youtube.com/watch?v=AN-iaHcXgYI
Duration: 1640 seg
---
Title: Git for Beginners Best Practices for Teams (Part 7)
URL: https://youtube.com/watch?v=Hd_BMpn4sBA
Duration: 661 seg
---
Title: How GitHub Actions 10x my productivity
URL: https://youtube.com/watch?v=yfBtjLxn_6k
Duration: 498 seg
---
Title: What is GitHub Issues?
URL: https://youtube.com/watch?v=6HWw7rhwvtY
Duration: 50 seg
---
Title: Best practices for securing GitHub in the cloud - Universe 2022
URL: https://youtube.com/watch?v=Z5AKsVdZijE
Duration: 662 seg
---
Title: GitHub Security Best Practices - GitHub Universe 2015
URL: https://youtube.com/watch?v=0MQihfI_OMA
Duration: 1999 seg
---
>>> 
JuanBindez commented 1 month ago

https://pytubefix.readthedocs.io/en/latest/user/search.html