• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 04:57
CET 10:57
KST 18:57
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
HomeStory Cup 28 - Info & Preview11Rongyi Cup S3 - Preview & Info3herO wins SC2 All-Star Invitational14SC2 All-Star Invitational: Tournament Preview5RSL Revival - 2025 Season Finals Preview8
Community News
Weekly Cups (Jan 19-25): Bunny, Trigger, MaxPax win3Weekly Cups (Jan 12-18): herO, MaxPax, Solar win0BSL Season 2025 - Full Overview and Conclusion8Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets4$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)38
StarCraft 2
General
HomeStory Cup 28 - Info & Preview StarCraft 2 Not at the Esports World Cup 2026 Weekly Cups (Jan 19-25): Bunny, Trigger, MaxPax win Oliveira Would Have Returned If EWC Continued herO wins SC2 All-Star Invitational
Tourneys
HomeStory Cup 28 KSL Week 85 $21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) OSC Season 13 World Championship $70 Prize Pool Ladder Legends Academy Weekly Open!
Strategy
Simple Questions Simple Answers
Custom Maps
[A] Starcraft Sound Mod
External Content
Mutation # 510 Safety Violation Mutation # 509 Doomsday Report Mutation # 508 Violent Night Mutation # 507 Well Trained
Brood War
General
Can someone share very abbreviated BW cliffnotes? BW General Discussion [ASL21] Potential Map Candidates BGH Auto Balance -> http://bghmmr.eu/ Bleak Future After Failed ProGaming Career
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 Azhi's Colosseum - Season 2 [BSL21] Non-Korean Championship - Starts Jan 10
Strategy
Zealot bombing is no longer popular? Simple Questions, Simple Answers Current Meta Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread Battle Aces/David Kim RTS Megathread Path of Exile Mobile Legends: Bang Bang Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia
Community
General
US Politics Mega-thread Canadian Politics Mega-thread Russo-Ukrainian War Thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine
Fan Clubs
The herO Fan Club! The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Let's Get Creative–Video Gam…
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
Customize Sidebar...

Website Feedback

Closed Threads



Active: 3021 users

[Programming Blog] autofan v0.05

Blogs > Loser777
Post a Reply
Loser777
Profile Blog Joined January 2008
1931 Posts
September 10 2013 02:28 GMT
#1
https://github.com/eqy/autofan
(works, but code is somewhat messy, needs tons of whitespace changes)
Tested build on Arch 3.10.10-1 and Ubuntu 12.04.2 (3.2.0-51).

Changes
  • Post parsing is now done with Xpath
  • Quotes do not interfere with processing
  • Redundant usernames do not appear in output


Following tarpman's suggestion on using XPath to navigate the parsed xml instead of unreadable/unmaintainable mess of name/content-based approaches, I've successfully merged my experimental XPath branch in to the master branch of the repo! The XPath-based approach allows for cleaner parsing, and most importantly, easy handling/removal of quotes within posts.

During the switch to XPath, there was a slightly annoying issue that led me to do this:

//We have a choice here between keeping the code simple, or keeping it pretty.
//This is because tidy does not like the use of span and div in the post header
//in the original page source, so it inserts an empty span with the same
//attribute (forummsginfo) as the offending span. This causes libxml2 to double
//count post headers and leads to a mess. We avoid this by using an uglier
//(table) XPath expression.
//Should using the complicating XPath be necessary at some point, the fix would
//be to discard any post headers that are empty as the tidy-generated spans are
//empty.
//const char * tltopic::POST_HEADER_XPATH = "//span[@class='forummsginfo']";
const char * tltopic::POST_HEADER_XPATH = "//td[@valign='top'and @class='titelbalk']";


Otherwise, most of the other changes were pretty straightforward: Quotes are handled by having a flag for ignoring quotes in tltopic objects that effectively nukes the nodes associated with the XPath expression for quotes. Protip: always work from end to the beginning of a set nodes when using xmlNodeSetContent:

for (q = n_quotes-1; q >= 0; q--)
{
xmlNodeSetContent(quote_object->nodesetval->nodeTab[q], (xmlChar *) "");
}

Working from beginning to end leads to nasty behavior involving nodes being freed twice due to the internal handling of the node tree.

Redundant usernames were eliminated with a hash table (I was lazy, so that's done with std::map).

The next step is to learn basic web development to make this widely accessible (I figured trying to port to Windows isn't worth the investment). I currently know what html tags are. Javascript+whatever else, here we come!
Who doesn't enjoy some shameless mental masturbation?


*****
6581
Please log in or register to reply.
Live Events Refresh
Next event in 2h 3m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
BRAT_OK 99
ProTech17
StarCraft: Brood War
Rain 1400
GuemChi 1314
Shuttle 1229
Hyuk 837
Larva 605
BeSt 457
firebathero 402
Sharp 217
Mini 196
Dewaltoss 155
[ Show more ]
Zeus 153
Soma 140
ggaemo 85
ToSsGirL 82
sorry 80
Pusan 79
Shinee 59
Hyun 52
Killer 52
Hm[arnc] 50
EffOrt 40
910 36
soO 35
hero 30
NaDa 27
Backho 17
Terrorterran 13
GoRush 11
Dota 2
NeuroSwarm141
Counter-Strike
allub183
Super Smash Bros
Westballz31
Other Games
mouzStarbuck326
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH199
• StrangeGG 55
• Adnapsc2 17
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1585
• Lourlo954
• Stunt417
Upcoming Events
HomeStory Cup
2h 3m
ShoWTimE vs sOs
Serral vs Reynor
Zoun vs HeRoMaRinE
Clem vs Lambo
OSC
3h 3m
Replay Cast
14h 3m
Replay Cast
1d 14h
Wardi Open
2 days
WardiTV Invitational
3 days
Replay Cast
3 days
The PondCast
4 days
WardiTV Invitational
4 days
Replay Cast
4 days
Liquipedia Results

Completed

Proleague 2026-01-31
OSC Championship Season 13
Underdog Cup #3

Ongoing

CSL 2025 WINTER (S19)
KCM Race Survival 2026 Season 1
Acropolis #4 - TS4
Rongyi Cup S3
HSC XXVIII
Nations Cup 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8

Upcoming

Escore Tournament S1: W7
Escore Tournament S1: W8
Acropolis #4
IPSL Spring 2026
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
LiuLi Cup: 2025 Grand Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.