• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 08:44
CET 14:44
KST 22:44
  • 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
ByuL: The Forgotten Master of ZvT25Behind the Blue - Team Liquid History Book17Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8
Community News
Weekly Cups (Feb 9-15): herO doubles up2ACS replaced by "ASL Season Open" - Starts 21/0241LiuLi Cup: 2025 Grand Finals (Feb 10-16)46Weekly Cups (Feb 2-8): Classic, Solar, MaxPax win2Nexon's StarCraft game could be FPS, led by UMS maker16
StarCraft 2
General
Behind the Blue - Team Liquid History Book ByuL: The Forgotten Master of ZvT Liquipedia WCS Portal Launched Kaelaris on the futue of SC2 and much more... How do you think the 5.0.15 balance patch (Oct 2025) for StarCraft II has affected the game?
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) StarCraft Evolution League (SC Evo Biweekly) How do the "codes" work in GSL? LiuLi Cup: 2025 Grand Finals (Feb 10-16)
Strategy
Custom Maps
Map Editor closed ? [A] Starcraft Sound Mod
External Content
Mutation # 513 Attrition Warfare The PondCast: SC2 News & Results Mutation # 512 Overclocked Mutation # 511 Temple of Rebirth
Brood War
General
Do you consider PvZ imbalanced? Recent recommended BW games BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion CasterMuse Youtube
Tourneys
Escore Tournament StarCraft Season 1 [Megathread] Daily Proleagues Small VOD Thread 2.0 KCM Race Survival 2026 Season 1
Strategy
Simple Questions, Simple Answers Zealot bombing is no longer popular? Fighting Spirit mining rates Current Meta
Other Games
General Games
Battle Aces/David Kim RTS Megathread Diablo 2 thread Nintendo Switch Thread ZeroSpace Megathread Path of Exile
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 TL Mafia Community Thread Mafia Game Mode Feedback/Ideas
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Canadian Politics Mega-thread Ask and answer stupid questions here! Things Aren’t Peaceful in Palestine
Fan Clubs
The IdrA Fan Club The herO Fan Club!
Media & Entertainment
[Req][Books] Good Fantasy/SciFi books [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion TL MMA Pick'em Pool 2013
World Cup 2022
Tech Support
TL Community
The Automated Ban List
Blogs
ASL S21 English Commentary…
namkraft
Inside the Communication of …
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1801 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
Sparkling Tuna Cup
10:00
Weekly #120
Shameless vs CreatorLIVE!
CranKy Ducklings124
LiquipediaDiscussion
PiG Sty Festival
09:00
Group D
YoungYakov vs ShoWTimELIVE!
ByuN vs Serral
PiGStarcraft1477
TKL 353
IndyStarCraft 245
BRAT_OK 175
Rex167
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft1451
TKL 327
IndyStarCraft 227
BRAT_OK 165
Rex 141
ProTech17
StarCraft: Brood War
Britney 47790
Calm 7282
Rain 5739
Jaedong 1627
Horang2 1544
actioN 1403
Larva 983
Mini 650
Stork 481
PianO 401
[ Show more ]
Soma 361
firebathero 356
Zeus 252
hero 193
Rush 184
Hyun 173
Last 144
Sharp 110
Dewaltoss 99
Pusan 88
Barracks 82
Shine 79
Killer 72
Movie 70
Sea.KH 64
JulyZerg 45
yabsab 44
sorry 41
ToSsGirL 33
soO 33
Sacsri 33
Hm[arnc] 32
Noble 20
scan(afreeca) 13
zelot 12
Terrorterran 10
HiyA 8
Icarus 6
Dota 2
Gorgc4266
qojqva1530
XcaliburYe204
canceldota101
febbydoto17
Counter-Strike
fl0m2639
zeus1266
byalli1087
x6flipin508
edward54
Super Smash Bros
Mew2King94
Heroes of the Storm
Khaldor283
MindelVK13
Other Games
singsing2512
B2W.Neo1257
Liquid`RaSZi1167
DeMusliM320
ToD186
KnowMe32
Organizations
Counter-Strike
PGL43243
StarCraft 2
WardiTV367
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos2916
Counter-Strike
• C_a_k_e 1474
Upcoming Events
Replay Cast
10h 16m
Replay Cast
19h 16m
Wardi Open
22h 16m
Monday Night Weeklies
1d 3h
OSC
1d 10h
WardiTV Winter Champion…
1d 22h
Replay Cast
2 days
WardiTV Winter Champion…
2 days
The PondCast
3 days
Replay Cast
4 days
[ Show More ]
Korean StarCraft League
5 days
CranKy Ducklings
5 days
SC Evo Complete
5 days
Replay Cast
6 days
Sparkling Tuna Cup
6 days
Liquipedia Results

Completed

[S:21] ASL SEASON OPEN 1st Round
LiuLi Cup: 2025 Grand Finals
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
WardiTV Winter 2026
PiG Sty Festival 7.0
Nations Cup 2026
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025

Upcoming

Acropolis #4 - TS5
Jeongseon Sooper Cup
Spring Cup 2026
[S:21] ASL SEASON OPEN 2nd Round
[S:21] ASL SEASON OPEN 2nd Round Qualifier
Acropolis #4 - TS6
Acropolis #4
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
RSL Revival: Season 4
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
FISSURE Playground #3
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
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.