Posts Tagged ‘loop’

How to loop a YouTube video?

December 17, 2018 Leave a comment

You have a favorite song and you want to listen to it in a loop.

Right click on the video and select “Loop”.

loop a youtube video

January 28, 2017 Leave a comment

You find an awesome music video and you want to play it in an infinite loop.

You need to re-format the youtube URL a bit. Sample:



Concrete example: input, output.

Tip from here.

Open URLs in browser tabs simultaneously

March 9, 2011 Leave a comment


From Python, you can easily open URLs in Firefox tabs:

#!/usr/bin/env python


import webbrowser
import sys

firefox = webbrowser.get('firefox')

for url in sys.stdin.readlines():
    url = url.rstrip("\n")

This script reads URLs from the standard input and opens them in separated tabs. Usage:

cat url_list.txt | ./

Where url_list.txt contains one URL per line.

It’s all very nice, but… The script will open the URLs one by one, which can be very slow (especially if you want to open several URLs). Would it be possible to open the URLs in tabs at the same time? That is, tell Firefox to assign a thread to each tab and process them simultaneously.


I found the solution in this thread. I won’t provide a source code, just sketch the idea:

  • If Firefox is not running yet, open the first URL with “firefox -new-window URL“. Do it with an external call.
  • For the rest of the URLs, open them with “firefox -new-tab URL“.

Here I suppose you have a running Firefox instance.

cat url_list.txt | while read i; do firefox -new-tab $i; done

Useful links

Related posts

In the post “Extract all links from a web page“, I show an interesting usage of the script Links of a web page are extracted with another script, and the extracted links are opened in Firefox tabs with All that is done in one line using pipes. Example:

./ | grep -i jpg | ./

Update (20110507)

The script is updated, now it can open tabs simultaneously too. Also, it can open links in a new window. See the source here.

Categories: bash, firefox, python Tags: , ,

Download all issues of Full Circle Magazine

January 27, 2011 5 comments


You want to get all the issues of Full Circle Magazine but you don’t want to download ’em one by one. Is there an easy and painless way to get them in a bundle?


Here are the necessary URLs till issue 47:

Save it to a file called down.txt, then download them all:

wget -i down.txt

Update (20110130) #1:

Unfortunately, issues below 10 are named as issueX_en.pdf and not as issue0X_en.pdf. Thus, if you download all the files and list them with ‘ls -al‘, issues < 10 will be mixed with the others. Here is how to fix it:

rename -n 's/issue(\d)_en(.*)/issue0$1_en$2/' *.pdf

It will just print the renames (without executing them). If the result is OK, remove the ‘-n‘ switch and execute the command again. Now the files will be renamed in order.

Update (20110130) #2:

This post was taken over by Ubuntu Life, and the user Capitán suggested an easier solution in a comment over there:


I didn’t know about this wget feature :) Now I see why issues < 10 are named as issueX_en.pdf and not as issue0X_en.pdf

Update (20110203): That {0..45} thing is actually expanded by bash, not by wget! See this post for more info.

Update (20110130) #3:

Another reader of Ubuntu Life, marco, suggests a bash script solution:

for i in {0..45}

Or, in one line:

for i in {0..45}; do wget${i}_en.pdf; done