Created
July 22, 2012 18:26
-
-
Save Olwaro/3160605 to your computer and use it in GitHub Desktop.
Capture img from 4chan thread code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="fr"> | |
<head> | |
<meta charset="utf-8"> | |
<title>???</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<!-- Le styles --> | |
<link href="bootstrap/css/bootstrap.css" rel="stylesheet"> | |
<style type="text/css"> | |
body { | |
padding-top: 60px; | |
padding-bottom: 40px; | |
} | |
</style> | |
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> | |
<!--[if lt IE 9]> | |
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
</head> | |
<body> | |
<div class="container"> | |
<textarea id="lol"></textarea> | |
<a class="btn" id="go">GO</a> | |
<br /> | |
<textarea id="links" style="width:400px;height:500px"></textarea> | |
</div> <!-- /container --> | |
<!-- Le javascript | |
================================================== --> | |
<!-- Placed at the end of the document so the pages load faster --> | |
<script src="jquery-1.7.2.min.js"></script> | |
<script> | |
// <a href="//images.4chan.org/hc/src/1338233038449.jpg" target="_blank">1338233038449.jpg</a> | |
/* $('#go').on('click', function() { | |
var reg = new RegExp("<a href=\"[^>]*>([^<]*)</a>",'g'); | |
var reg2 = new RegExp(".*\.jpg"); | |
//var resultat = $('#lol').text().match(reg); | |
var resultat = reg.exec(($('#lol').text())); | |
while(resultat != null) | |
{ | |
if(resultat[1].match(reg2)) | |
$('#links').append('http://images.4chan.org/hc/src/'+resultat[1]+'\n'); | |
resultat = reg.exec(($('#lol').text())); | |
} | |
}); */ | |
$('#go').on('click', function() { | |
var url = new RegExp("<a href=\"([^\"]*)",'gm'); | |
var ext = new RegExp(".*\.jpg"); | |
var resultat = url.exec(($('#lol').val())); | |
while(resultat != null) | |
{ | |
if(resultat[1].match(ext)) | |
$('#links').append('http:'+resultat[1]+'\n'); | |
resultat = url.exec(($('#lol').val())); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment