Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 56 lines (46 sloc) 1.6 KB
#!/bin/bash
## flickr2vimeo
##
## Author: See-ming Lee <seeminglee@gmail.com>
## License: GNU GPLv3
##
## Copyright 2009 See-ming Lee http://seeminglee.com
##
## flickr2vimeo is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/
##
## ==================================================================
##
## Extract URLs from 'selection source' on a Flickr set
## for use with, for example, generating a list of URL for Vimeo photo pointing
##
## Example
## 1. On Firefox, Go to a Flickr set page
## 2. Select all the thumbnails
## 3. Right-click and select "View Selection Source"
## 4. Copy and paste html fragments into foo.html
## 5. flickr2vimeo foo.html
# register param
FILENAME=$1
TMP='/tmp/flickr2vimeo-tempfile'
# extract URL
perl -0ne 'print "$1\n" while (/a href=\"(.*?)\">.*?<\/a>/igs)' $FILENAME \
| sed -r 's/(.+)\"\ title.+/\1/' \
| sed -r 's/(.+)\/in.+/\1/' \
| sed -r 's/(.+)/http:\/\/flickr.com\1/' > $TMP
#concat string to a single line
echo `cat $TMP` \
| sed -r 's/\ /, /gi'
#remove temp file
rm -rf $TMP
exit 0