-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathborderpage_parser.py
More file actions
60 lines (47 loc) · 29.7 KB
/
borderpage_parser.py
File metadata and controls
60 lines (47 loc) · 29.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import json
import re
import os
import requests
from collections import OrderedDict
from copy import deepcopy
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.settings")
from pytz import timezone
import django
from datetime import datetime as dt
import time
django.setup()
from todos.models import TodoList, TodoType
cookies = dict()
cookies['usercookie1'] = 'Livvo'
cookies['usercookie2'] = '6f295f9a509f539e824cf369cf055207'
cookies['user'] = 'Livvo%40www.lastknights.com'
cookies['PHPSESSID'] = 't2jd2261j1lc34gqbnjdpsc0t5'
while True:
print('{} Sleeping for 30'.format(dt.utcnow()))
time.sleep(30)
map_large_page = requests.get(url='http://www.lastknights.com/index.php?loc=border',
cookies=cookies)
#content = str(b'<html><head>\n<META HTTP-EQUIV="imagetoolbar" CONTENT="no"><META NAME="DESCRIPTION" CONTENT="Play online multiplayer strategy game Last Knights (lastknights)."><META NAME="ABSTRACT" CONTENT="online multiplayer, TLK, RPG, Wargame, world game, strategy game, Role playing game, MMORTS, wargames, massive multiplayer online game, mmo rpg, massive multiplayer game, rts, text based rpg, real time strategy, strategy rpg, browser rpg, massive multiplayer online game, real time strategy game, rts game, online army, web based rpg, web based rts, medieval, medieval war game, medieval Europe, medieval RTS, huge battles, medieval game."><META NAME="KEYWORDS" CONTENT="online multiplayer, TLK, RPG, Wargame, world game, strategy game, Role playing game, MMORTS, wargames, massive multiplayer online game, mmo rpg, massive multiplayer game, rts, text based rpg, real time strategy, strategy rpg, browser rpg, massive multiplayer online game, real time strategy game, rts game, online army, web based rpg, web based rts, medieval, medieval war game, medieval Europe, medieval RTS, huge battles, medieval game."><meta property="og:site_name" content="The Last Knights"><meta property="og:title" content="The Last Knights - Medieval online real time strategy game (MMORTS)"><meta property="og:type" content="game"><meta property="og:image" content="http://www.lastknights.com/images/banners/medrect-static.jpg"><meta property="og:url" content="http://www.lastknights.com/"><meta property="og:description" content="The Last Knights is a Massively Multiplayer Online Real Time Strategy Game (MMORTS) set in Medieval Europe/Asia."><meta property="fb:admins" content="100000200145354"><title>The Last Knights - Medieval online real time social strategy game (MMORTS)</title>\n<link rel="stylesheet" type="text/css" href="css/style.css?v6.0">\n<script type="text/javascript" src="csjs/jquery.js"></script>\n<script type="text/javascript" src="csjs/global.js?v=13"></script>\n<script type="text/javascript" src="csjs/shortcut.js?v=3.1"></script>\n<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>\n<script type="text/javascript" src="csjs/overlib_minibs.js"><!-- overLIB (c) Erik Bosrup --></script><style type="text/css">span#player92938 {font-weight: bold;}</style>\n<link rel="icon" type="image/png" href="/favicon.ico">\n<!-- #TOPSCRIPT# -->\n<!-- This is all google ad code stuff -->\n<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion_async.js" charset="utf-8"></script>\n<script type=\'text/javascript\'>\nvar googletag = googletag || {};\ngoogletag.cmd = googletag.cmd || [];\n (function() {\nvar gads = document.createElement(\'script\');\ngads.async = true;\ngads.type = \'text/javascript\';\nvar useSSL = \'https:\' == document.location.protocol;\ngads.src = (useSSL ? \'https:\' : \'http:\') + \n\'//www.googletagservices.com/tag/js/gpt.js\';\nvar node = document.getElementsByTagName(\'script\')[0];\nnode.parentNode.insertBefore(gads, node);\n})();\n</script>\n\n<script type=\'text/javascript\'>\n googletag.cmd.push(function() {\n googletag.defineSlot(\'/151428060/Last-Knights-Header-Banner\', [468, 60], \'div-gpt-ad-1449333081025-0\').addService(googletag.pubads());\n googletag.defineSlot(\'/151428060/Last-Knights-Content-Leaderboard\', [728, 90], \'div-gpt-ad-1449415237738-0\').addService(googletag.pubads());\n googletag.defineSlot(\'/151428060/Last-Knights-Content-Med-Rect\', [300, 250], \'div-gpt-ad-1447259409305-0\').addService(googletag.pubads());\n googletag.defineSlot(\'/151428060/Last-Knights-Side-Skyscraper\', [120, 600], \'div-gpt-ad-1447259488648-0\').addService(googletag.pubads());\n googletag.defineSlot(\'/151428060/Last-Knights-Content-Small-Square\', [200, 200], \'div-gpt-ad-1447259561623-0\').addService(googletag.pubads());\n googletag.defineSlot(\'/151428060/Last-Knights-Side-Wide-Sky\', [160, 600], \'div-gpt-ad-1447259630792-0\').addService(googletag.pubads());\n\n\n googletag.pubads().enableSingleRequest();\n googletag.pubads().enableSyncRendering();\n googletag.enableServices();\n });\n</script>\n<!-- End of ad code -->\n<!-- #HEAD# -->\n<script type="text/javascript">$SA = {s:249258, asynch: 1, useBlacklistUrl: 1};(function() { var sa = document.createElement("script"); sa.type = "text/javascript"; sa.async = true; sa.src = ("https:" == document.location.protocol ? "https://" + $SA.s + ".sa" : "http://" + $SA.s + ".a") + ".siteapps.com/" + $SA.s + ".js"; var t = document.getElementsByTagName("script")[0]; t.parentNode.insertBefore(sa, t);})();</script></head>\n<body class="europe">\n<form name="shortcut" action="index.php" method="POST" style="display:inline">\n<input type="hidden" name="border" value="0">\n<input type="hidden" name="healer" value="0">\n<input type="hidden" name="armory" value="0">\n<input type="hidden" name="tournament" value="0">\n<input type="hidden" name="headquarters" value="0">\n<input type="hidden" name="castle" value="0"></form>\n\n<table class = "width_1145" id="page">\n<tr><td valign="top" colspan = "4" class="header">\n<a href="index.php" title="The Last Knights - Free Online Social Strategy Game"><img src="images/logo_tlk.png" style="float: left;"></a>\n<div style="margin-left:85px;margin-top:5px;float:right;"><!-- Last-Knights-Header-Banner -->\n</div></td></tr>\n<tr>\n<td class="menu" valign="top" width="150">\n\n<table width="100%">\n<tr><td><!-- #PLAYER_START# --><a href="index.php?page=settings&tab=timezone" title="set your timezone" class="clock" ><!-- #PLAYER_END# --><div id="game-clock"> \n<div id="my-time"><span class="hours"></span>:<span class="minutes"></span><sup style="font-size:13"> (+7)</sup>\n</div>\n<div id="next-tick">Next tick <span class="minutes"></span>:<span class="seconds"></span></div>\n</div></a>\n<script>\nvar my_time_start = 36058;\nvar server_time_start = 10858;\nvar next_tick_start = 1742;\nvar d = new Date();\nvar time_start = d.getTime();\nupdate_game_clock();\n</script></td></tr>\n<tr><td>\n<a class = "button" href = "index.php" style="text-decoration:none"><u>C</u>ity center</a><ul>\n<li><a class = "menu" href = "index.php?page=camp" style="text-decoration:none"><u>E</u>ncampment</a></ul><h2>Your Country</h2>\n<ul>\n<li><a class = "menu" href = "chat.php" style="text-decoration:none" target="_blank">Chat</a>\n<li><a class = "menu" href = "index.php?page=friends" style="text-decoration:none">Pla<u>y</u>ers</a>\n<li><a class = "menu" href = "index.php?page=country" style="text-decoration:none">Co<u>u</u>ntry Talk</a>\n<li><a class = "menu" href = "index.php?page=battle&sel=pvp" style="text-decoration:none">PVP Results</a>\n</ul><h2>Age 213</h2><p >Day 6</p>\n<ul>\n<li><a class = "menu" href = "index.php?page=map" style="text-decoration:none"><u>M</u>ap</a>\n<li><a class = "menu" href = "index.php?page=forum">TLK Forum</a>\n<li><a class = "menu" href = "ranking.php?countries=1" style="text-decoration:none">Countries</a>\n<li><a class = "menu" href = "index.php?page=wars" style="text-decoration:none"><u>W</u>ars</a>\n<li><a class = "menu" href = "ranking.php" style="text-decoration:none"><u>R</u>anking</a>\n<li><a class = "menu" href = "index.php?page=stats">Stats</a>\n<li><a class = "menu" href = "index.php?page=battle&sel=city" style="text-decoration:none">City Battles</a>\n</ul><h2>Resources</h2>\n<ul>\n<li><a class = "menu" href = "index.php?page=news">News</a>\n<li><a class = "menu" href = "reference.php">Reference Guide</a>\n<li><a class = "menu" href = "faq.php">Faq / Help</a>\n<li><a class = "menu" href = "vip.php">Nobility</a>\n<li><a class = "menu" href = "index.php?page=hof">Hall of Fame</a>\n<li><a class = "menu" href = "index.php?page=contact">Contact/Staff</a>\n<li><a class = "menu" href = "https://bitbucket.org/tlkgamedevelopmentltd/the-last-knights/issues" target="_blank">Bugs, issues & ideas</a>\n</ul><img src=/images/ornament.gif></td></tr></table>\n\n</td>\n<td width="768" valign="top">\n<div id="userbar" class="alert">\n<a href="index.php?page=profile&country=Berber" ><img src="/images/flags/europe/Berber.png" alt="Berber" class="flag symbol" title="Berber" /></a> <img src="/images/Vice Marshal.png" alt="Vice Marshal" class="rank symbol" title="Vice Marshal" /> Vice Marshal <a href="index.php?page=profile&username=Livvo" class="userlink">Livvo</a> <a href="index.php?action=logout" class="logout">[logout]</a>\n\n<div class="usermenu">\n<a href="#" onclick=\'location.reload(true); return false;\' title="Refresh"><img src="images/icons/reload.png" class="icon"></a>\n<a href="index.php?page=msg" title="Messages (s)"><img src="images/icons/envelope-small.png" class="icon"><span id="unread-msg" class="counter">1</span></a>\n<a href="index.php?page=battle" title="Your battle results" class="battleresults"><img src="images/battle-small.png" class="icon"><span id="new-battles" class="counter">0</span></a>\n<a href="buddy.php" title="Friends"><img src="images/icons/friends.png" class="icon"></a>\n<a href="index.php?page=settings" title="Profile (p)"><img src="images/icons/cog.png" class="icon"></a>\n</div>\n</div>\n<audio id="battle-alert" preload="auto">\n<source src="sounds/battle-alert2.mp3" type="audio/mp3">\n<source src="sounds/battle-alert2.wav" type="audio/wav">\n</audio>\n<audio id="msg-alert" preload="auto">\n<source src="sounds/msg-alert3.mp3" type="audio/mp3">\n<source src="sounds/msg-alert3.wav" type="audio/wav">\n</audio>\n<script>\nvar playsounds = \'1\';\nvar battlecount = -1;\nvar messagecount = -1;\nvar fromsession = 0;\nupdate_unread_counters(10000);\n</script>\n\n<table width="100%" class="main"> <!-- <table class="main width_100%"> Nuvelle code-->\n<tr><td valign="top">\n<h2>Border of Duargla (Desert) - <a href="index.php">Back to centre</a></h2><table width="100%"><tr><td valign="top"><h3>Border training</h3><table><form action="index.php?loc=border" method="post"><input type="hidden" name="type" value="village"><input type="hidden" name="id" value="Neapolitan"><input type="hidden" name="terrain" value="Desert"><input type="hidden" name="nr" value="720"><tr><td colspan="2"><img src="/images/Desert_icon.png" alt="Desert" class="terrain symbol" title="Desert" /> Neapolitan village (Desert <span class="terrain-positive" >+5%</span>)</td><td><input class="button terrain-button desert" type="submit" name="attack_now" value="Attack" onclick="return confirm(\'Are you sure you want to attack?\');"></td><td></td></tr></form><form action="index.php?loc=border" method="post"><input type="hidden" name="type" value="village"><input type="hidden" name="id" value="Neapolitan"><input type="hidden" name="terrain" value="Mountains"><input type="hidden" name="nr" value="720"><tr><td colspan="2"><img src="/images/Mountains_icon.png" alt="Mountains" class="terrain symbol" title="Mountains" /> Neapolitan village (Mountains <span class="terrain-positive" >+6%</span>)</td><td><input class="button terrain-button mountains" type="submit" name="attack_now" value="Attack" onclick="return confirm(\'Are you sure you want to attack?\');"></td><td></td></tr></form></table><img class="location" src="images/content/europe/border.jpg" /></td><td valign="top" width="70%"><h3>Nearby enemy cities</h3><table width="100%"><form action="index.php?loc=border" method="post"><input type="hidden" name ="type" value="city"><input type="hidden" name ="target_name" value="Constantine"><input type="hidden" name ="id" value="48"><tr><td width="50%">Constantine* (Mountains)</td><td width="50%">Naples</td><td><input class="button small" type="submit" name="attack" value="Attack"></td><td><input class="button small" type="submit" name="spy" value="Spy"></td></tr></form><form action="index.php?loc=border" method="post"><input type="hidden" name ="type" value="city"><input type="hidden" name ="target_name" value="Ghardaia"><input type="hidden" name ="id" value="49"><tr><td width="50%">Ghardaia* (Mountains)</td><td width="50%">Naples</td><td><input class="button small" type="submit" name="attack" value="Attack"></td><td><input class="button small" type="submit" name="spy" value="Spy"></td></tr></form><form action="index.php?loc=border" method="post"><input type="hidden" name ="type" value="city"><input type="hidden" name ="target_name" value="El Golea"><input type="hidden" name ="id" value="71"><tr><td width="50%">El Golea* (Desert)</td><td width="50%">Naples</td><td><input class="button small" type="submit" name="attack" value="Attack"></td><td><input class="button small" type="submit" name="spy" value="Spy"></td></tr></form><tr><td colspan="4"><i>*For these targets your subofficers will fight along with you. You are not advised to attack them alone.</i></td></tr></table><h3>Nearby enemy army camps</h3><table width="100%"><form action="index.php?loc=border" method="post"><input type="hidden" name ="type" value="player"><input type="hidden" name ="target_name" value="Mewtwo"><input type="hidden" name ="id" value="19007"><tr class="even"><td width="5"><image src="images/offline.gif" title="offline"></td><td width="50%">Sergeant** Mewtwo</td><td width="50%">Naples</td><td width="100">-</td><td width="100"><input class="button small" type="submit" name="spy" value="Spy"></td></tr></form></table></td></tr></table>\n</td></tr></table>\n</td>\n<td class="banner" valign="top" width="162"><!-- Last-Knights-Side-Wide-Sky -->\n</td></tr>\n</table>\n<!-- #BOTTOMADSCRIPT# -->\n<div class="center">\n<p><small>© 2005–2015 <a href="http://www.lastknights.com">TLK Game Development LTD</a> || <a href="disclaimer.php" rel="nofollow">Disclaimer</a></small></p>\n</div>\n</body>\n</html><script language="javascript"\ntype="text/javascript">window.status="mysql: 6 queries in 0.0068 sec. php: 0.0185 sec.";</script>')
#content = '<html> <head> \n <META HTTP-EQUIV="imagetoolbar" CONTENT="no"> <META NAME="DESCRIPTION" CONTENT="Play online multiplayer strategy game Last Knights (lastknights)."> <META NAME="ABSTRACT" CONTENT="online multiplayer, TLK, RPG, Wargame, world game, strategy game, Role playing game, MMORTS, wargames, massive multiplayer online game, mmo rpg, massive multiplayer game, rts, text based rpg, real time strategy, strategy rpg, browser rpg, massive multiplayer online game, real time strategy game, rts game, online army, web based rpg, web based rts, medieval, medieval war game, medieval Europe, medieval RTS, huge battles, medieval game."> <META NAME="KEYWORDS" CONTENT="online multiplayer, TLK, RPG, Wargame, world game, strategy game, Role playing game, MMORTS, wargames, massive multiplayer online game, mmo rpg, massive multiplayer game, rts, text based rpg, real time strategy, strategy rpg, browser rpg, massive multiplayer online game, real time strategy game, rts game, online army, web based rpg, web based rts, medieval, medieval war game, medieval Europe, medieval RTS, huge battles, medieval game."> <meta property="og:site_name" content="The Last Knights"> <meta property="og:title" content="The Last Knights - Medieval online real time strategy game (MMORTS)"> <meta property="og:type" content="game"> <meta property="og:image" content="http://www.lastknights.com/images/banners/medrect-static.jpg"> <meta property="og:url" content="http://www.lastknights.com/"> <meta property="og:description" content="The Last Knights is a Massively Multiplayer Online Real Time Strategy Game (MMORTS) set in Medieval Europe/Asia."> <meta property="fb:admins" content="100000200145354"> <title>The Last Knights - Medieval online real time social strategy game (MMORTS)</title> \n <link rel="stylesheet" type="text/css" href="css/style.css?v6.0"> \n<script type="text/javascript" src="csjs/jquery.js"></script>\n<script type="text/javascript" src="csjs/global.js?v=13"></script>\n<script type="text/javascript" src="csjs/shortcut.js?v=3.1"></script>\n <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> \n<script type="text/javascript" src="csjs/overlib_minibs.js"><!-- overLIB (c) Erik Bosrup --></script> <style type="text/css">span#player92938 {font-weight: bold;}</style> \n <link rel="icon" type="image/png" href="/favicon.ico"> \n<!-- #TOPSCRIPT# -->\n<!-- This is all google ad code stuff -->\n<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion_async.js" charset="utf-8"></script>\n<script type=\'text/javascript\'>\nvar googletag = googletag || {};\ngoogletag.cmd = googletag.cmd || [];\n (function() {\nvar gads = document.createElement(\'script\');\ngads.async = true;\ngads.type = \'text/javascript\';\nvar useSSL = \'https:\' == document.location.protocol;\ngads.src = (useSSL ? \'https:\' : \'http:\') + \n\'//www.googletagservices.com/tag/js/gpt.js\';\nvar node = document.getElementsByTagName(\'script\')[0];\nnode.parentNode.insertBefore(gads, node);\n})();\n</script>\n\n<script type=\'text/javascript\'>\n googletag.cmd.push(function() {\n googletag.defineSlot(\'/151428060/Last-Knights-Header-Banner\', [468, 60], \'div-gpt-ad-1449333081025-0\').addService(googletag.pubads());\n googletag.defineSlot(\'/151428060/Last-Knights-Content-Leaderboard\', [728, 90], \'div-gpt-ad-1449415237738-0\').addService(googletag.pubads());\n googletag.defineSlot(\'/151428060/Last-Knights-Content-Med-Rect\', [300, 250], \'div-gpt-ad-1447259409305-0\').addService(googletag.pubads());\n googletag.defineSlot(\'/151428060/Last-Knights-Side-Skyscraper\', [120, 600], \'div-gpt-ad-1447259488648-0\').addService(googletag.pubads());\n googletag.defineSlot(\'/151428060/Last-Knights-Content-Small-Square\', [200, 200], \'div-gpt-ad-1447259561623-0\').addService(googletag.pubads());\n googletag.defineSlot(\'/151428060/Last-Knights-Side-Wide-Sky\', [160, 600], \'div-gpt-ad-1447259630792-0\').addService(googletag.pubads());\n\n\n googletag.pubads().enableSingleRequest();\n googletag.pubads().enableSyncRendering();\n googletag.enableServices();\n });\n</script>\n<!-- End of ad code -->\n<!-- #HEAD# -->\n<script type="text/javascript">$SA = {s:249258, asynch: 1, useBlacklistUrl: 1};(function() { var sa = document.createElement("script"); sa.type = "text/javascript"; sa.async = true; sa.src = ("https:" == document.location.protocol ? "https://" + $SA.s + ".sa" : "http://" + $SA.s + ".a") + ".siteapps.com/" + $SA.s + ".js"; var t = document.getElementsByTagName("script")[0]; t.parentNode.insertBefore(sa, t);})();</script> </head> \n <body class="europe"> \n <form name="shortcut" action="index.php" method="POST" style="display:inline">\n<input type="hidden" name="border" value="0">\n<input type="hidden" name="healer" value="0">\n<input type="hidden" name="armory" value="0">\n<input type="hidden" name="tournament" value="0">\n<input type="hidden" name="headquarters" value="0">\n<input type="hidden" name="castle" value="0"></form> \n\n <table class = "width_1145" id="page"> \n <tr> <td valign="top" colspan = "4" class="header"> \n<a href="index.php" title="The Last Knights - Free Online Social Strategy Game"><img src="images/logo_tlk.png" style="float: left;"></a>\n <div style="margin-left:85px;margin-top:5px;float:right;"> <!-- Last-Knights-Header-Banner -->\n </div> </td> </tr> \n <tr> \n <td class="menu" valign="top" width="150"> \n\n <table width="100%"> \n <tr> <td> <!-- #PLAYER_START# --> <a href="index.php?page=settings&tab=timezone" title="set your timezone" class="clock" > <!-- #PLAYER_END# --> <div id="game-clock"> \n <div id="my-time"><span class="hours"></span>:<span class="minutes"></span><sup style="font-size:13"> (+7)</sup>\n</div> \n <div id="next-tick">Next tick <span class="minutes"></span>:<span class="seconds"></span></div> \n </div> </a> \n<script>\nvar my_time_start = 36058;\nvar server_time_start = 10858;\nvar next_tick_start = 1742;\nvar d = new Date();\nvar time_start = d.getTime();\nupdate_game_clock();\n</script> </td> </tr> \n <tr> <td> \n<a class = "button" href = "index.php" style="text-decoration:none"><u>C</u>ity center</a> <ul> \n <li><a class = "menu" href = "index.php?page=camp" style="text-decoration:none"><u>E</u>ncampment</a> </ul> <h2>Your Country</h2> \n <ul> \n <li><a class = "menu" href = "chat.php" style="text-decoration:none" target="_blank">Chat</a>\n <li><a class = "menu" href = "index.php?page=friends" style="text-decoration:none">Pla<u>y</u>ers</a>\n <li><a class = "menu" href = "index.php?page=country" style="text-decoration:none">Co<u>u</u>ntry Talk</a>\n <li><a class = "menu" href = "index.php?page=battle&sel=pvp" style="text-decoration:none">PVP Results</a>\n </ul> <h2>Age 213</h2> <p >Day 6</p> \n <ul> \n <li><a class = "menu" href = "index.php?page=map" style="text-decoration:none"><u>M</u>ap</a>\n <li><a class = "menu" href = "index.php?page=forum">TLK Forum</a>\n <li><a class = "menu" href = "ranking.php?countries=1" style="text-decoration:none">Countries</a>\n <li><a class = "menu" href = "index.php?page=wars" style="text-decoration:none"><u>W</u>ars</a>\n <li><a class = "menu" href = "ranking.php" style="text-decoration:none"><u>R</u>anking</a>\n <li><a class = "menu" href = "index.php?page=stats">Stats</a>\n <li><a class = "menu" href = "index.php?page=battle&sel=city" style="text-decoration:none">City Battles</a>\n </ul> <h2>Resources</h2> \n <ul> \n <li><a class = "menu" href = "index.php?page=news">News</a>\n <li><a class = "menu" href = "reference.php">Reference Guide</a>\n <li><a class = "menu" href = "faq.php">Faq / Help</a>\n <li><a class = "menu" href = "vip.php">Nobility</a>\n <li><a class = "menu" href = "index.php?page=hof">Hall of Fame</a>\n <li><a class = "menu" href = "index.php?page=contact">Contact/Staff</a>\n <li><a class = "menu" href = "https://bitbucket.org/tlkgamedevelopmentltd/the-last-knights/issues" target="_blank">Bugs, issues & ideas</a>\n </ul> <img src=/images/ornament.gif> </td> </tr> </table> \n\n </td> \n <td width="768" valign="top"> \n <div id="userbar" class="alert"> \n<a href="index.php?page=profile&country=Berber" ><img src="/images/flags/europe/Berber.png" alt="Berber" class="flag symbol" title="Berber" /></a> <img src="/images/Vice Marshal.png" alt="Vice Marshal" class="rank symbol" title="Vice Marshal" /> Vice Marshal <a href="index.php?page=profile&username=Livvo" class="userlink">Livvo</a> <a href="index.php?action=logout" class="logout">[logout]</a>\n\n <div class="usermenu">\n<a href="#" onclick=\'location.reload(true); return false;\' title="Refresh"><img src="images/icons/reload.png" class="icon"></a>\n<a href="index.php?page=msg" title="Messages (s)"><img src="images/icons/envelope-small.png" class="icon"><span id="unread-msg" class="counter">1</span></a>\n<a href="index.php?page=battle" title="Your battle results" class="battleresults"><img src="images/battle-small.png" class="icon"><span id="new-battles" class="counter">0</span></a>\n<a href="buddy.php" title="Friends"><img src="images/icons/friends.png" class="icon"></a>\n<a href="index.php?page=settings" title="Profile (p)"><img src="images/icons/cog.png" class="icon"></a>\n</div> \n </div> \n <audio id="battle-alert" preload="auto"> \n <source src="sounds/battle-alert2.mp3" type="audio/mp3"> \n <source src="sounds/battle-alert2.wav" type="audio/wav"> \n </audio> \n <audio id="msg-alert" preload="auto"> \n <source src="sounds/msg-alert3.mp3" type="audio/mp3"> \n <source src="sounds/msg-alert3.wav" type="audio/wav"> \n </audio> \n<script>\nvar playsounds = \'1\';\nvar battlecount = -1;\nvar messagecount = -1;\nvar fromsession = 0;\nupdate_unread_counters(10000);\n</script>\n\n <table width="100%" class="main"> <!-- <table class="main width_100%"> Nuvelle code-->\n <tr> <td valign="top"> \n <h2>Border of Duargla (Desert) - <a href="index.php">Back to centre</a></h2> <table width="100%"> <tr> <td valign="top"> <h3>Border training</h3> <table> <form action="index.php?loc=border" method="post"> <input type="hidden" name="type" value="village"><input type="hidden" name="id" value="Neapolitan"><input type="hidden" name="terrain" value="Desert"><input type="hidden" name="nr" value="720"> <tr> <td colspan="2"><img src="/images/Desert_icon.png" alt="Desert" class="terrain symbol" title="Desert" /> Neapolitan village (Desert <span class="terrain-positive" >+5%</span>)</td> <td><input class="button terrain-button desert" type="submit" name="attack_now" value="Attack" onclick="return confirm(\'Are you sure you want to attack?\');"></td> <td></td> </tr> </form> <form action="index.php?loc=border" method="post"> <input type="hidden" name="type" value="village"><input type="hidden" name="id" value="Neapolitan"><input type="hidden" name="terrain" value="Mountains"><input type="hidden" name="nr" value="720"> <tr> <td colspan="2"><img src="/images/Mountains_icon.png" alt="Mountains" class="terrain symbol" title="Mountains" /> Neapolitan village (Mountains <span class="terrain-positive" >+6%</span>)</td> <td><input class="button terrain-button mountains" type="submit" name="attack_now" value="Attack" onclick="return confirm(\'Are you sure you want to attack?\');"></td> <td></td> </tr> </form> </table> <img class="location" src="images/content/europe/border.jpg" /> </td> <td valign="top" width="70%"> <h3>Nearby enemy cities</h3> <table width="100%"> <form action="index.php?loc=border" method="post"> <input type="hidden" name ="type" value="city"><input type="hidden" name ="target_name" value="Constantine"><input type="hidden" name ="id" value="48"> <tr> <td width="50%">Constantine* (Mountains)</td> <td width="50%">Naples</td> <td><input class="button small" type="submit" name="attack" value="Attack"></td> <td><input class="button small" type="submit" name="spy" value="Spy"></td> </tr> </form> <form action="index.php?loc=border" method="post"> <input type="hidden" name ="type" value="city"><input type="hidden" name ="target_name" value="Ghardaia"><input type="hidden" name ="id" value="49"> <tr> <td width="50%">Ghardaia* (Mountains)</td> <td width="50%">Naples</td> <td><input class="button small" type="submit" name="attack" value="Attack"></td> <td><input class="button small" type="submit" name="spy" value="Spy"></td> </tr> </form> <form action="index.php?loc=border" method="post"> <input type="hidden" name ="type" value="city"><input type="hidden" name ="target_name" value="El Golea"><input type="hidden" name ="id" value="71"> <tr> <td width="50%">El Golea* (Desert)</td> <td width="50%">Naples</td> <td><input class="button small" type="submit" name="attack" value="Attack"></td> <td><input class="button small" type="submit" name="spy" value="Spy"></td> </tr> </form> <tr> <td colspan="4"><i>*For these targets your subofficers will fight along with you. You are not advised to attack them alone.</i></td> </tr> </table> <h3>Nearby enemy army camps</h3> <table width="100%"> <form action="index.php?loc=border" method="post"> <input type="hidden" name ="type" value="player"><input type="hidden" name ="target_name" value="Mewtwo"><input type="hidden" name ="id" value="19007"> <tr class="even"> <td width="5"> <image src="images/offline.gif" title="offline"> </td> <td width="50%">Sergeant** Mewtwo</td> <td width="50%">Naples</td> <td width="100">-</td> <td width="100"><input class="button small" type="submit" name="spy" value="Spy"></td> </tr><tr class="even"> <td width="5"> <image src="images/offline.gif" title="offline"> </td> <td width="50%">Sergeant** Mewtwo</td> <td width="50%">Naples</td> <td width="100">-</td> <td width="100"><input class="button small" type="submit" name="spy" value="Spy"></td> </tr><tr class="even"> <td width="5"> <image src="images/offline.gif" title="offline"> </td> <td width="50%">Sergeant** Mewtwo</td> <td width="50%">Naples</td> <td width="100">-</td> <td width="100"><input class="button small" type="submit" name="spy" value="Spy"></td> </tr> </form> </table> </td> </tr> </table> \n </td> </tr> </table> \n </td> \n <td class="banner" valign="top" width="162"> <!-- Last-Knights-Side-Wide-Sky -->\n </td> </tr> \n </table> \n<!-- #BOTTOMADSCRIPT# -->\n <div class="center"> \n <p><small>© 2005–2015 <a href="http://www.lastknights.com">TLK Game Development LTD</a> || <a href="disclaimer.php" rel="nofollow">Disclaimer</a></small></p> \n </div> \n </body> \n</html><script language="javascript"\ntype="text/javascript">window.status="mysql: 6 queries in 0.0068 sec. php: 0.0185 sec.";</script>'
content = str(map_large_page.content)
pvp_items = re.findall('<h3>Nearby enemy army camps</h3>.*?<table width="100%">.*?</table>', content, re.DOTALL)
rows = None
if pvp_items:
rows = re.findall('width="50%">(.*?)</td>.*?width="50%">(.*?)</', pvp_items[0], re.DOTALL)
tz_custom = timezone('Europe/Amsterdam')
for row in rows:
default_tlk = {
'created': dt.utcnow(),
'todo_type': TodoType.objects.get(group='TLKPVP_BORDER'),
'date_deadline': dt.now().replace(year=2100, month=1, day=1, hour=0, minute=0, microsecond=0,
tzinfo=timezone('Europe/Amsterdam'))
}
data = json.dumps(row)
todolist_item, created = TodoList.objects.get_or_create(defaults=default_tlk, data=data, todo_type=TodoType.objects.get(group='TLKPVP_BORDER'))
todolist_item.data = data
todolist_item.status = False
todolist_item.save()
print('Adding {} {}'.format(data, created))
if not pvp_items and not rows:
TodoList.objects.filter(todo_type_id=4, status=0).update(status=1)
print('Nothing found on the border, setting existing PVP items to status = 1')