WingTillDie / youtube-video-length

Searches YouTube video with specified duration by YouTube Data API
Apache License 2.0
25 stars 5 forks source link

No output #2

Closed myrajurek closed 7 months ago

myrajurek commented 1 year ago

i am using this query

C:\Users\maxim\Downloads\youtube-video-length-main\youtube-video-length-main> python youtube-video-length.py -s 1387 -q "23 min 07 sec yt vid"

and getting no output to my console at all it just takes a second and then waits for another command

myrajurek commented 1 year ago

as well as when i do this PS C:\Users\maxim\Downloads\youtube-video-length-main\youtube-video-length-main> python youtube-video-length.py -i PT27M7S -q "27:07" PS C:\Users\maxim\Downloads\youtube-video-length-main\youtube-video-length-main> i just get no console output the api requests are going through because i can see the usage of my api key on my google cloud dev console but im just not getting any any output to my command prompt

vanyamlb commented 9 months ago

Same for me. No output! :(

vanyamlb commented 9 months ago

@WingTillDie pls help

m0d1nst4ll3r commented 7 months ago

No output simply because there was no result to your query.

The query (what you type after '-q') is the same as what you type in the searchbox on youtube to find videos.

You can't type "23 min 07 sec yt vid" and expect youtube to spit something out. Try to type that into youtube (or google) and see how relevant the results are. This program is no less magical than google's search algorithms are (although they are pretty magical already).

Typing "27:07" also likely won't give you any results. Sometimes it will, but it's not a guarantee. Instead, try multiple queries with words that you think are likely to be in the video title.

You can try "27:07" first as some videos will have their duration already in the title, you can also try "27:06" as the duration in the title might be rounded differently, but if that doesn't work for you then you might need to get creative with search queries.

E.g try "be" "the" "at" "like" and other words commonly used in video titles.

WingTillDie commented 3 days ago

@myrajurek @vanyamlb Thanks for your question
I improved the program output when no match to guide user on how to solve it
And added a flowchat on README.md

$ ./youtube-video-length.py -s 1387 -q "23 min 07 sec yt vid"
ERROR: No match with specified filter time. Try change -q, -m arguments, or use -l to list search results without filtering by time
A search result without applying time filter:
Video Title: 23 minutes and 48 seconds of claps
Video ID: Eix_an1AT_o
Video Duration (ISO): PT23M49S
Video Duration (s): 1429 seconds
flowchart TD
    Query[Search String: cat funny<br>-q #34;cat funny#34;]
    Top[Top 100 Search Results<br>-m 100]
    Query --> Top
    Top --> Is_Filter
    Is_Filter{Enable Filter by Video Length?}
    Is_Filter -->|No| list[/--list/]
    Is_Filter -->|Yes| Time_Format
    Time_Format{Filter Time Format}
    Time_Format -->|seconds| Seconds
    Seconds[/--seconds/]
    Time_Format -->|ISO 8601| ISO_8601
    ISO_8601[/--iso-8601/]