Clean NFO's to post on forums

Status
Not open for further replies.

Tango

Moderator
Staff member
4,125
2009
1,764
21,765
This is usefull if you use Yawns leecher script, a lot of the posts it leeches has a nfo link and no info with the post.
If you want to put the nfo text into your post paste the nfo text into the box and it will give you some cleaner code to post.

This isnt going to work with full ascii NFO's but none of the sites Yawns script leeches uses them.

eg. paste in the text from this link
http://nfomation.net/info/1281219184.00-dirt_nasty-nasty_as_i_wanna_be-2010.nfo

And you get some text to post

Code:
                               H o s t s   P r e s e n t s :

[b]Artist[/b] .: Dirt Nasty
[b]Album[/b] ..: Nasty As I Wanna Be
[b]Year[/b] ...: 2010

[b]Ripped[/b] .: 2010/08/07          [b]Source[/b] .: CD
[b]Retail[/b] .: 2010/08/10          Lang ...: English
[b]Genre[/b] ..: Hip-Hop             Size ...: 82.08 MB
[b]Label[/b] ..: RBC Records         [b]Ripper[/b] .: TEAM FiH

[b]Encoder[/b]: LAME v3.97 -V2 --vbr-new
[b]Quality[/b]: 182kbps/44.1KHz/Joint Stereo
[b]Grabber[/b]: Exact Audio Copy V0.99 beta 5


Track:              Track Titles:                 Length:
01-  Nasty As I Wanna Be                             4:21
02-  Boombox                                         3:19
03-  Milk Milk Lemonade Ft. Too Short And Warren   3:28
G
04-  Motel Room                                      3:49
05-  Big In Japan                                    3:32
06-  So L.A.                                         3:39
07-  Turn It Up Ft. Beardo                           3:00
08-  Lookin For A Nasty Girl                        3:15
09-  Fuck Me Im Famous                              5:12
10-  Miami Nights Ft. Keha And Benji Hughes         4:35
11-  I Cant Dance Ft. LMFAO                         4:55
12-  Cougars Ft. Bonnie Mckee                        4:38
13-  Suck My Dick                                    3:20
14-  Canal Street Ft. Christian George               4:58
15-  Gibberish Ft. Andy Milonakis And Andre Legacy   3:31


Time: 0h 59min

Then you just need to edit it a little if needed and have saved some time :)
PHP:
<?
echo "<form method='post' action=''>"
 ."<textarea id='nfo' name='nfo' rows='15' cols='80' style='width: 100%'></textarea>"
 ."<input type='submit' name='go' value='Remove Shite' />"
 ."</form>";
if (isset($_POST['go'])) {
 $cleaned = preg_replace('/&#\d{0,10000};/', ' ',($_POST['nfo'])); 
 $cleaned = preg_replace('/([^\w\d\s\-\:\.\/]+)/', '', $cleaned);
 $cleaned = preg_replace('/[ ]*(\r{0,1}\n)[ ]*/', '$1', $cleaned);
 $cleaned = preg_replace('/(ripper|supplier|genre|release date|theater date|source|aspect ratio|video format|video resolution|video bitrate|audio bitrate|runtime|rating|language|subtitle|substitle|dvd date|audio format|video aspect|video length|theatre date|framerate|video codec|audio codec|dir name|artist|album|year|retail|label|encoder|quality|grabber|ripped|video fps|imdb rating)/i', '[b]$1[/b]', $cleaned); 
 echo "<pre>".$cleaned."</pre>";
}
?>
 
16 comments
Its Useful for people using Yawns leecher script, a lot of the leeched stuff only has a NFO link for the info & its a pain in the ass editing it to post it
 
Nice, you may also check out
Code:
http://fulafisken.com/nfo-2.php5

Source available at

Code:
http://fulafisken.com/nfo-2.phps
 
Nice copy pasting. But you do know that this won't clean a real NFO but instead turn it into odd text? You strip all its ASCII. If you really want to make an NFO forum compatible you have to convert its encoding and not remove the stuff which makes it an NFO in the first place ;).
 
PHP:
<?
echo "<form method='post' action=''>"
 ."<textarea id='nfo' name='nfo' rows='15' cols='80' style='width: 100%'></textarea>"
 ."<input type='submit' name='go' value='Remove Shite' />"
 ."</form>";
if (isset($_POST['go'])) {
 $cleaned = preg_replace('/([^\w\d\s\-:.,\/\\]+)/', '', html_entity_decode($_POST['nfo']));
 // you don't need to do this in this case
 //$cleaned = preg_replace('/[ ]*(\r{0,1}\n)[ ]*/', '$1', $cleaned);
 $cleaned = preg_replace('/(ripper|supplier|genre|release date|theater date|source|aspect ratio|video format|video resolution|video bitrate|audio bitrate|runtime|rating|language|subtitle|substitle|dvd date|audio format|video aspect|video length|theatre date|framerate|video codec|audio codec|dir name|artist|album|year|retail|label|encoder|quality|grabber|ripped|video fps|imdb rating)/i', '[b]$1[/b]', $cleaned); 
 echo "<pre>".$cleaned."</pre>";
}
?>

Just a suggestion.
 
whats the php-imdb link for? imdbphp is better
http://projects.izzysoft.de/trac/imdbphp


If you use Yawns leecher script a lot of the time you have to copy/paste the nfo from the post and it works with the sites that are leeched, so this is just to save time.

its 14 lines of code and im not good with coding, its not ment to be a full on converter

I just posted it to help people not to get bashed :D



just seen your post, it isnt working
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 20 in /var/www/vhosts/xxxxxx/nfo.php on line 7
 
Ok, that would be a bug in the regular expression engine since that's a valid regex. If I move the escaped slash to the front it magically works.

PHP:
<?
echo "<form method='post' action=''>"
 ."<textarea id='nfo' name='nfo' rows='15' cols='80' style='width: 100%'></textarea>"
 ."<input type='submit' name='go' value='Remove Shite' />"
 ."</form>";
if (isset($_POST['go'])) {
 $cleaned = preg_replace('/([^\\\w\d\s\-:.,\/]+)/', '', html_entity_decode($_POST['nfo']));
 // you don't need to do this in this case
 //$cleaned = preg_replace('/[ ]*(\r{0,1}\n)[ ]*/', '$1', $cleaned);
 $cleaned = preg_replace('/(ripper|supplier|genre|release date|theater date|source|aspect ratio|video format|video resolution|video bitrate|audio bitrate|runtime|rating|language|subtitle|substitle|dvd date|audio format|video aspect|video length|theatre date|framerate|video codec|audio codec|dir name|artist|album|year|retail|label|encoder|quality|grabber|ripped|video fps|imdb rating)/i', '[b]$1[/b]', $cleaned); 
 echo "<pre>".$cleaned."</pre>";
}
?>
I can't believe this language is still as buggy as it was 6 years ago.
 
I did try to use html_entity_decode, but got the same result as you get with that code.

the page is filled with numbers..
eg. 9604960496009600960096049604 so I tried using regex to remove them, then clean up whitespace, but the results wernt reliable so i ended up with the code i posted.
 
See this is why after a while I really started hating PHP. It's a great language for the job but it's filled with tiny issues, bugs and design flaws. Unbelievable.

This thread is only a few lines of code and we already found:
- there's at least one bug in the regex parser
- the HTML decoder is flawed or has poor error compensating (or unsupported encoding)

All hail C#/.NET.
 
I have updated the 1st post with a working example, and stated that it will only work with nfo's for sites used by Yawns leecher.

I think that's the confusion, i didn't make this to work with full ascii nfos only for the sites i needed :)
 
Status
Not open for further replies.
Back
Top