Advertisement
Guest User

Untitled

a guest
Jan 5th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. username="YourUserNameGoesHere"
  4. password="YourPassWordGoesHere"
  5. youtube="https://www.youtube.com/results?search_query=hollywood+pedophile"
  6.  
  7. # create new api key
  8. echo "Creating API Key"
  9. curl -X POST -H "Authorization: Basic Zm9vOmJhcg==" -d "username=${username}&password=${password}" https://api.vid.me/auth/create > key.txt
  10.  
  11. # searching for the api key and store in variable
  12. accesstoken=$(grep -oP 'token":"\K[^"]+' key.txt)
  13.  
  14. # finding new videos on youtube
  15. echo "Downloading youtube page"
  16. wget -O videos.html "${youtube}"
  17.  
  18. # search for youtube titles
  19. echo "searching for youtube titles"
  20. grep -oP '(?<=dir="ltr">).*?(?=</a><span class="accessible-description")' videos.html > video-titles.txt
  21.  
  22. # search for youtube urls
  23. echo "searching for youtube URLS"
  24. grep -Po '(?<=href="/watch)[^"]*' videos.html | uniq > video-urls.txt
  25.  
  26. # add a prefix to every youtube url to make it complete
  27. echo "adding prefix to urls to make them complete"
  28. sed -i -e 's,^,https://www.youtube.com/watch,' video-urls.txt
  29.  
  30. # loop through urls and titles for upload
  31. while IFS= read -r lineA && IFS= read -r lineB <&3; do
  32.  
  33. # upload file to vid.me
  34. curl -X POST -H "AccessToken: ${accesstoken}" -d "url=${lineB}" -d "title=${lineA}" -d "description=${lineA}" https://api.vid.me/grab
  35. # go to sleep to avoid rate limit
  36. sleep 30
  37.  
  38. done <video-titles.txt 3<video-urls.txt
  39.  
  40. # clean up files
  41. rm key.txt videos.html video-urls.txt video-titles.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement