• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 07:00
CET 13:00
KST 21:00
  • 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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
[BSL21] Non-Korean Championship - Starts Jan 100SC2 All-Star Invitational: Jan 17-1819Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises2Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies3ComeBackTV's documentary on Byun's Career !11
StarCraft 2
General
SC2 All-Star Invitational: Jan 17-18 Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises Chinese SC2 server to reopen; live all-star event in Hangzhou Starcraft 2 Zerg Coach ComeBackTV's documentary on Byun's Career !
Tourneys
OSC Season 13 World Championship WardiTV Mondays $5,000+ WardiTV 2025 Championship $100 Prize Pool - Winter Warp Gate Masters Showdow Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes Mutation # 504 Retribution Mutation # 503 Fowl Play
Brood War
General
I would like to say something about StarCraft A cwal.gg Extension - Easily keep track of anyone BGH Auto Balance -> http://bghmmr.eu/ (UMS) SWITCHEROO *New* /Destination Edit/ What monitor do you use for playing Remastered?
Tourneys
SLON Grand Finals – Season 2 [BSL21] Non-Korean Championship - Starts Jan 10 [Megathread] Daily Proleagues [BSL21] Grand Finals - Sunday 21:00 CET
Strategy
Simple Questions, Simple Answers Current Meta [G] How to get started on ladder as a new Z player Fighting Spirit mining rates
Other Games
General Games
General RTS Discussion Thread Nintendo Switch Thread Awesome Games Done Quick 2026! Stormgate/Frost Giant Megathread Mechabellum
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Canadian Politics Mega-thread The Games Industry And ATVI 12 Days of Starcraft
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced
Blogs
National Diversity: A Challe…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1621 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 1h
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 234
StarCraft: Brood War
PianO 1897
Horang2 1560
Shuttle 1018
Jaedong 813
Larva 618
Stork 496
Soma 442
actioN 326
Light 306
Mini 258
[ Show more ]
EffOrt 243
Mong 226
sorry 184
Hyuk 140
ZerO 138
hero 123
Pusan 101
ggaemo 97
Snow 91
Sharp 90
Hyun 78
Killer 66
Rush 62
Barracks 59
JYJ 51
ToSsGirL 46
zelot 23
Icarus 23
ajuk12(nOOB) 19
soO 18
yabsab 16
Noble 15
Terrorterran 12
HiyA 12
Sacsri 10
scan(afreeca) 9
GoRush 8
Shine 4
Dota 2
syndereN470
NeuroSwarm94
League of Legends
C9.Mang0493
Counter-Strike
x6flipin567
Other Games
B2W.Neo1576
singsing838
Fuzer 243
ZerO(Twitch)25
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• LUISG 23
• Adnapsc2 15
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos2683
• Stunt615
Upcoming Events
OSC
1h
Korean StarCraft League
15h
OSC
1d
IPSL
1d 2h
Dewalt vs Bonyth
OSC
1d 6h
OSC
2 days
uThermal 2v2 Circuit
2 days
Replay Cast
2 days
Patches Events
3 days
OSC
4 days
[ Show More ]
OSC
5 days
OSC
6 days
Liquipedia Results

Completed

C-Race Season 1
WardiTV 2025
META Madness #9

Ongoing

IPSL Winter 2025-26
BSL Season 21
Slon Tour Season 2
CSL Season 19: Qualifier 2
Escore Tournament S1: W2
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025

Upcoming

CSL 2025 WINTER (S19)
Escore Tournament S1: W3
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Thunderfire SC2 All-star 2025
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
Underdog Cup #3
NA Kuram Kup
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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.