fork download
  1. import requests
  2. import os
  3. import webbrowser
  4.  
  5. ID = int(input('URLのvideoの後ろにある、現在のIDを入力してください。\n例→ http://w...content-available-to-author-only...s.com/video1234567/ \nだったら[1234567]\nID:'))
  6. hit = int(input('検索件数を入力してください。※50件以上はマズイと思う\n検索件数:'))
  7. i = 0
  8. with open('./videolist.html','w') as file:#videolistの初期化、特に何もしないのでpass
  9. pass
  10.  
  11. for i in range(hit):
  12. url = ('http://w...content-available-to-author-only...s.com/video'+ str(ID+i)+'/')
  13. url = requests.get(url)
  14.  
  15. if url.status_code == 404:#もしない場合はその直前のIDを記録
  16. current_ID = ('http://w...content-available-to-author-only...s.com/video'+ str(ID+i-1)+'/')
  17. with open('newest_ID.html','w') as file:
  18. file.write(current_ID)
  19. else:
  20. html=('<iframe src="https://w...content-available-to-author-only...s.com/embedframe/' + str(ID+i) + '"' + ' frameborder=0 width=510 height=400 scrolling=no allowfullscreen=allowfullscreen></iframe>')#動画自動生成
  21. with open('./videolist.html','a') as file:#'a'は追記モード、ファイルがない場合は新規作成
  22. file.write(html+str('\n'))
  23. i += 1
  24. print('残り'+str(hit-i+1))
  25.  
  26. path = os.path.abspath('videolist.html')
  27. web = 'file:///'+path
  28. print(web)
  29. webbrowser.open_new(web)
Runtime error #stdin #stdout #stderr 0.02s 27712KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
    import requests
ImportError: No module named 'requests'