shailshouryya / yt-videos-list

Create and **automatically** update a list of all videos on a YouTube channel (in txt/csv/md form) via YouTube bot with end-to-end web scraping - no API tokens required. Multi-threaded support for YouTube videos list updates.
Apache License 2.0
107 stars 20 forks source link

Can lc.create_list_for() return the csv file name? #4

Closed skill4net closed 4 years ago

skill4net commented 4 years ago

lc.create_list_for(url=channel_url)

will complete all jobs but return nothing.

Can make lc.create_list_for() return the csv file name, so we can use csv_file_name = lc.create_list_for(url=channel_url) for next processing? e.g. we can get video url from from the csv file then download the video.

Thank you.

shailshouryya commented 4 years ago

Hmm so based on your suggestion I'm guessing this would be used to:

Does that seem right? In this case I can return the file_name as the result of lc.create_list_for(url=channel_url). This way, you can also choose to do anything with the txt or md file if you need in addition to csv, since you can append the extension for whichever file you want to work with.

Does this sound okay, or are there some more modifications that would make it better?

shailshouryya commented 4 years ago

Pushed a fix in the commit above ↑

With this change, you can do:

file_name     = lc.create_list_for(url=channel_url)
csv_file_name = f'{file_name}.csv'
txt_file_name = f'{file_name}.txt'
md_file_name  = f'{file_name}.md'

Does this address the problem, or is there anything else we should add? @skill4net

shailshouryya commented 4 years ago

Hiding this comment due to outdated information (already merged into master).

Merged the corresponding PR (#6) for this issue since I didn't see any activity on this issue nor on #6.

Please reopen this issue if the problem still exists!

This change is now in the main branch and will be available from running pip install -U yt-videos-list following the next PyPI release, but if you want to run it before the release is formally pushed (might take a few days), run the following:

git clone https://github.com/slow-but-steady/yt_videos_list.git
cd yt_videos_list\python
pip install .    # Windows
python           # Windows
pip3 install .   # MacOS/Linux
python3          # MacOS/Linux

from yt_videos_list import ListCreator

lc = ListCreator()
file_name     = lc.create_list_for(url=channel_url)
csv_file_name = f'{file_name}.csv'
txt_file_name = f'{file_name}.txt'
md_file_name  = f'{file_name}.md'