egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Strip & Save images from a given link

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
BigToe
Halfop


Joined: 30 Dec 2010
Posts: 99

PostPosted: Tue Jun 26, 2012 4:23 am    Post subject: Strip & Save images from a given link Reply with quote

hi I need a strip that once a link is entered in the form of !strip <link here>

It will write the link to a file called 'dupes.db' that is located in /home/botdir/eggdrops/scripts/dupes.db

And will save to the shell to /home/botdir/eggdrops/images/ all the images that are on that link.

For example:

!strip http://www.imdb.com/news/ni30809410/

will download and save all the images on that page and add http://www.imdb.com/news/ni30809410/ to dupes.db
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sat Jun 30, 2012 9:05 am    Post subject: Reply with quote

If you need images from<img> tag, try something like this:

Code:
#!/usr/bin/tclsh

package require http
package require htmlparse

set http_handle [http::geturl "http://www.imdb.com/news/ni30809410/"]
set http_data [http::data $http_handle]

set img_link ""

proc zonk { tag slash param tbtt} {
        if {$tag == "img"} {
                #add ' to the regex etc.
                regsub -all -nocase {.*src=\"(.*?)\".*} $param {\1} img_link
                puts $img_link
        }
}

::htmlparse::parse -cmd zonk $http_data


Quote:
tomekk@tweety:~/strip# ./strip.tcl
http://ad.doubleclick.net/ad/imdb2.consumer.main/news;tile=2;sz=728x90,1008x150,1008x200,1008x30,9x1;p=t;p=top;ct=com;ka=0;ord=396664578584?

http://ad.doubleclick.net/ad/imdb2.consumer.main/news;tile=4;sz=1008x60,1008x66,7x1;p=ns;ct=com;ka=0;ord=396664578584?

http://ia.media-imdb.com/images/M/MV5BMTgwMjA1OTM3Ml5BMl5BanBnXkFtZTcwMjQzNjM4Nw@@._V1._SY140_.jpg

http://ad.doubleclick.net/ad/imdb2.consumer.main/news;tile=3;sz=300x250,11x1;p=tr;p=tc;ct=com;ka=0;ord=396664578584?

http://ia.media-imdb.com/images/M/MV5BMjA2NDY0Mzg1M15BMl5BanBnXkFtZTcwNDkyNzY5NQ@@._V1.jpg
http://i.media-imdb.com/images/SF9bb191c6827273aa978cab39a3587950/b.gif

http://ad.doubleclick.net/ad/imdb2.consumer.main/news;tile=1;sz=728x90,2x1;p=b;ct=com;ka=0;ord=396664578584?

/rd/?q=50703000000030a090f29616f226e276966600000010c6a0022303132303633303c29353334383c29353032393c29353032373c293533343730000001037a040379646370000001047&cb=1341061390403
http://b.scorecardresearch.com/p?c1=2&c2=6034961&c3=&c4=http%3A%2F%2Fwww.imdb.com%2Fnews%2Fni30809410%2F&c5=c6=&15=&cj=1


Do the rest for the egg.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber