EchterAlsFake / xvideos_api

a Python API for xvideos.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cant download multiple videos from a text file in shell

sugizo opened this issue · comments

steps

pip install git+https://github.com/EchterAlsFake/xvideos_api
from xvideos_api.xvideos_api import Client
from xvideos_api.modules.sorting import SortDate, Sort, SortQuality, SortVideoTime
client = Client()
search = 'school'
videos = Client.search(search, pages = 1,
                       sorting_Date = SortDate.Sort_all,
                       sort_Quality = SortQuality.Sort_all,
                       sorting_Sort = Sort.Sort_length,
                       sorting_Time = SortVideoTime.Sort_really_long)
f = open("urls.txt", "w")
for video in videos:
    print(video.length, video.url)
    f.write('%s \n' % video.url)
f.close()
!cat urls.txt
!xvideos_api --file 'urls.txt' --quality 'best' --downloader 'threaded'

result

[##################################################] 100.0%Traceback (most recent call last):
  File "/usr/local/bin/xvideos_api", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/xvideos_api/xvideos_api.py", line 325, in main
    video.download(quality=args.quality, downloader=args.downloader, path=args.output)
  File "/usr/local/lib/python3.10/dist-packages/xvideos_api/xvideos_api.py", line 169, in download
    Core().download(video=self, quality=quality, path=path, callback=callback, downloader=downloader)
  File "/usr/local/lib/python3.10/dist-packages/base_api/base.py", line 110, in download
    threaded_download(video=video, quality=quality, path=path, callback=callback)
  File "/usr/local/lib/python3.10/dist-packages/base_api/modules/download.py", line 72, in wrapper
    with open(path, 'wb') as file:
TypeError: expected str, bytes or os.PathLike object, not NoneType

p.s.
in xvideos_api
during download a single video
from command line,
must define output file name

it's different from phub,
that have the default output file name taken from url provided

suggestion for download single or multiple
nice to have default output file name taken from url provided

best regards