| View previous topic :: View next topic |
| Author |
Message |
BigToe Halfop
Joined: 30 Dec 2010 Posts: 99
|
Posted: Tue Jun 26, 2012 4:23 am Post subject: Strip & Save images from a given link |
|
|
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 |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Sat Jun 30, 2012 9:05 am Post subject: |
|
|
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
|
Do the rest for the egg. |
|
| Back to top |
|
 |
|
|
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
|
|