Showing posts with label download. Show all posts
Showing posts with label download. Show all posts

Saturday, April 11, 2020

use youtube-dl with sites that need credentials/cookies

You might want to download something with youtube-dl, and get the following error:

ERROR: XXXX requires authentication. You may want to use --cookies.


Quick way to get the cookies and do the download:
1. get the chromium/chrome extension Editthiscookie
https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg/related?hl=en

2. on editthiscookie's settings, go to options -> "Choose the preferred
export format for cookies" -> "Netscape HTTP Cookie File"

3. on the site you're trying to download the video, click on
editthiscookie's extension, export

4. paste/yank your clipboard's contents into a file

5. do youtube-dl --cookies exported_cookies_file https://the-vid-you-wanted-to-download

Thursday, October 19, 2017

LINE timeline video download

If you live in Japan you'll probably be using LINE to chat with everyone.

Here's how you can download movies from your timeline (your android won't let you without rooting it...).

You'll need:
1. chrome or chromium
2. the chrome line app? (maybe not needed)
3. some html/javascript knowledge?

This is what you do:
1. Login to your LINE account using the chrome LINE app
2. Click on the timeline icon on the app, this will take you to somewhere like https://timeline.line.me
3. Login to the timeline screeen
4. Do Ctrl-Shift-J to get the javascript console

5-a. You can inspect the DOM html code until the vid you want is highlighted, and click until you find the "video" html tag, then just copy paste the src attribute's value (an mp4 vid url)

5-b You can also just get all the vids in the page by typing the javascript:

  document.getElementsByTagName('video')

 if it's only one, then

  document.getElementsByTagName('video')[0].src

should give you the url for the vid, you just copy paste this

6. paste in browser's omnibar and start downloading!


Sunday, August 7, 2011

get/backup a user's tweets by bash

A shell script to download all the tweets of some user to a text file.

Put the contents of this file to a file called get_tweets.sh for example.
Then do "chmod +x get_tweets.sh"
And follow the usage instructions.
#!/bin/bash
#written by rikijpn
#use me like this:
#get_tweets.sh $SOME_USER
#or replace the USERNAME variable for the name of the wanted user
#get_tweets.sh

if [ ! -z $1 ] ;then
    USERNAME=$1
else
    USERNAME=linuxquestions #any default user name you want
fi
URL="http://twitter.com/$USERNAME?page="
FILE_TO_SAVE="tweets.txt"
TEMP_PAGE=`date +%d%m%H%M%S`.txt

printf "\n" > $FILE_TO_SAVE

for PAGE_NUMBER in {1..1000}; do 
    echo "getting page number $PAGE_NUMBER..."
    wget -O $TEMP_PAGE "$URL""$PAGE_NUMBER" 2>/dev/null;
    RELEVANT_LINES_NUMBER=`grep -e 'entry-content' -e 'timestamp' $TEMP_PAGE|wc -l`
    if [ $RELEVANT_LINES_NUMBER -lt 1 ] ; then  break; fi
    grep -e 'entry-content' -e 'timestamp' $TEMP_PAGE |
    sed \
 -e 's,.*<span class="entry-content">,,g' \
 -e 's,</span>,,g' \
 -e 's,.*<span class="published timestamp" data="{time:,,g' \
 -e "s/'//g" \
 -e 's/}">/ --> /g' \
 -e 's/<a.[^>]*>\(.[^<]*\)<\/a>/\1/g' \
 -e 's/^.*<span class="shared-content">/<RETWEET>/g' \
 -e 's/<\/a>/ in local time\n/g' >>$FILE_TO_SAVE
    sleep 5
done

rm $TEMP_PAGE
echo "all pages fetched"
exit 0

It differences "retweets", and outputs the date so you can tell when was it posted.

You can read it at my personal webpage as well.