• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 07:48
CET 13:48
KST 21:48
  • 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
Behind the Blue - Team Liquid History Book15Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8herO wins SC2 All-Star Invitational14
Community News
ACS replaced by "ASL Season Open" - Starts 21/0222LiuLi Cup: 2025 Grand Finals (Feb 10-16)26Weekly Cups (Feb 2-8): Classic, Solar, MaxPax win2Nexon's StarCraft game could be FPS, led by UMS maker10PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar)14
StarCraft 2
General
How do you think the 5.0.15 balance patch (Oct 2025) for StarCraft II has affected the game? Nexon's StarCraft game could be FPS, led by UMS maker Terran Scanner Sweep Behind the Blue - Team Liquid History Book Weekly Cups (Jan 12-18): herO, MaxPax, Solar win
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament RSL Season 4 announced for March-April PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) LiuLi Cup: 2025 Grand Finals (Feb 10-16) RSL Revival: Season 4 Korea Qualifier (Feb 14)
Strategy
Custom Maps
Map Editor closed ? [A] Starcraft Sound Mod
External Content
The PondCast: SC2 News & Results Mutation # 512 Overclocked Mutation # 511 Temple of Rebirth Mutation # 510 Safety Violation
Brood War
General
ACS replaced by "ASL Season Open" - Starts 21/02 Which units you wish saw more use in the game? StarCraft player reflex TE scores [ASL21] Potential Map Candidates Gypsy to Korea
Tourneys
Escore Tournament StarCraft Season 1 [Megathread] Daily Proleagues Small VOD Thread 2.0 KCM Race Survival 2026 Season 1
Strategy
Fighting Spirit mining rates Zealot bombing is no longer popular? Simple Questions, Simple Answers Current Meta
Other Games
General Games
Path of Exile Nintendo Switch Thread Diablo 2 thread Battle Aces/David Kim RTS Megathread ZeroSpace Megathread
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
TL Mafia Community Thread Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia
Community
General
US Politics Mega-thread Ask and answer stupid questions here! Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread The Games Industry And ATVI
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
World Cup 2022
Tech Support
TL Community
The Automated Ban List
Blogs
The Search For Meaning in Vi…
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2397 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
LiuLi Cup
11:00
2025 Grand Finals Playoffs
Maru vs ReynorLIVE!
Serral vs Rogue
RotterdaM2123
ComeBackTV 1450
PiGStarcraft691
IndyStarCraft 390
BRAT_OK 296
Rex239
3DClanTV 106
IntoTheiNu 27
Liquipedia
Sparkling Tuna Cup
10:00
Weekly #119
Creator vs KrystianerLIVE!
ByuN vs TBD
CranKy Ducklings117
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 2123
PiGStarcraft691
IndyStarCraft 390
BRAT_OK 296
Rex 239
EmSc Tv 19
StarCraft: Brood War
Britney 30010
Rain 3095
Sea 2878
Flash 1484
firebathero 1476
actioN 1251
Stork 520
Mini 310
Rush 291
EffOrt 262
[ Show more ]
Last 220
Soma 218
Hyun 167
ggaemo 140
Sharp 114
JYJ 78
ToSsGirL 49
Movie 47
Sea.KH 44
Backho 36
sorry 33
sSak 31
GoRush 21
Shine 19
soO 16
IntoTheRainbow 15
JulyZerg 13
yabsab 13
zelot 10
Sacsri 10
Noble 5
Icarus 5
Terrorterran 1
Calm 0
Dota 2
Dendi1097
XaKoH 778
XcaliburYe375
Fuzer 280
Counter-Strike
olofmeister4151
fl0m2270
x6flipin457
Super Smash Bros
Mew2King83
Heroes of the Storm
Khaldor220
Other Games
singsing2683
B2W.Neo933
crisheroes223
Liquid`RaSZi145
KnowMe35
MindelVK12
Organizations
Counter-Strike
PGL35559
StarCraft 2
EmSc Tv 19
EmSc2Tv 19
StarCraft: Brood War
lovetv 9
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH175
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• FirePhoenix4
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2133
League of Legends
• Jankos3212
• Stunt589
Upcoming Events
Ladder Legends
5h 12m
Replay Cast
11h 12m
Replay Cast
20h 12m
Wardi Open
23h 12m
Monday Night Weeklies
1d 4h
OSC
1d 11h
WardiTV Winter Champion…
1d 23h
PiGosaur Cup
2 days
Replay Cast
2 days
WardiTV Winter Champion…
2 days
[ Show More ]
Replay Cast
3 days
PiG Sty Festival
3 days
The PondCast
3 days
KCM Race Survival
3 days
WardiTV Winter Champion…
3 days
Replay Cast
4 days
PiG Sty Festival
4 days
Epic.LAN
4 days
Replay Cast
5 days
PiG Sty Festival
5 days
CranKy Ducklings
5 days
Epic.LAN
5 days
Replay Cast
6 days
PiG Sty Festival
6 days
Sparkling Tuna Cup
6 days
Liquipedia Results

Completed

Proleague 2026-02-14
Rongyi Cup S3
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
LiuLi Cup: 2025 Grand Finals
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

Escore Tournament S1: King of Kings
[S:21] ASL SEASON OPEN 1st Round
[S:21] ASL SEASON OPEN 1st Round Qualifier
[S:21] ASL SEASON OPEN 2nd Round
[S:21] ASL SEASON OPEN 2nd Round Qualifier
Acropolis #4
IPSL Spring 2026
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
RSL Revival: Season 4
WardiTV Winter 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.