Commit f8b69daf authored by Melroy van den Berg's avatar Melroy van den Berg

Improved parser + more categories

parent 642ad931
This diff is collapsed.
......@@ -21,9 +21,10 @@ args = parser.parse_args()
print (TextColor.OKGREEN + "INFO: Running Marktplaats Batch %s" % str(__version__) + TextColor.ENDC)
if args.categories:
print (TextColor.OKGREEN + "INFO: All available categories in Marktplaats Batch:\n" + TextColor.ENDC)
print (TextColor.OKGREEN + "INFO: All available (free) product categories in Marktplaats Batch:\n" + TextColor.ENDC)
for c in MP_Category:
<li class="item " data-val="567">Babyfoons</li>
<li class="item " data-val="1489">Babyvoeding en Toebehoren</li>
<li class="item " data-val="577">Babywiegjes en Ledikanten</li>
<li class="item " data-val="578">Badjes en Verzorging</li>
<li class="item " data-val="2133">Dekens en Slaapzakjes</li>
<li class="item " data-val="1952">Kraamcadeaus en Geboorteborden</li>
<li class="item " data-val="1706">Tweelingen en Meerlingen benodigheden</li>
<li class="item " data-val="568">Babykleding Maat 50</li>
<li class="item " data-val="569">Babykleding Maat 56</li>
<li class="item " data-val="570">Babykleding Maat 62</li>
<li class="item " data-val="571">Babykleding Maat 68</li>
<li class="item " data-val="572">Babykleding Maat 74</li>
<li class="item " data-val="573">Babykleding Maat 80</li>
<li class="item " data-val="574">Babykleding Maat 86</li>
<li class="item " data-val="1673">Mutsen, Sjaals en Wanten Baby's</li>
<li class="item " data-val="2777">Petten en Hoeden Baby's</li>
<li class="item " data-val="2130">Prematuur kleding</li>
<li class="item " data-val="576">Schoentjes en Sokjes Baby's</li>
<li class="item " data-val="575">Overige Babykleding</li>
<li class="item " data-val="1892">boeken Zwangerschap en Opvoeding</li>
<li class="item " data-val="582">Kinderkleding Maat 92</li>
<li class="item " data-val="583">Kinderkleding Maat 98</li>
<li class="item " data-val="584">Kinderkleding Maat 104</li>
<li class="item " data-val="585">Kinderkleding Maat 110</li>
<li class="item " data-val="586">Kinderkleding Maat 116</li>
<li class="item " data-val="587">Kinderkleding Maat 122</li>
<li class="item " data-val="588">Kinderkleding Maat 128</li>
<li class="item " data-val="589">Kinderkleding Maat 134</li>
<li class="item " data-val="590">Kinderkleding Maat 140</li>
<li class="item " data-val="591">Kinderkleding Maat 146</li>
<li class="item " data-val="592">Kinderkleding Maat 152</li>
<li class="item " data-val="593">Kinderkleding Maat 158</li>
<li class="item " data-val="594">Kinderkleding Maat 164</li>
<li class="item " data-val="595">Kinderkleding Maat 170</li>
<li class="item " data-val="596">Kinderkleding Maat 176</li>
<li class="item " data-val="2129">Carnavalskleding en Verkleedspullen Kinderkleding</li>
<li class="item " data-val="1672">Mutsen, Sjaals en Handschoenen Kinderkleding</li>
<li class="item " data-val="2776">Petten en Hoeden Kinderkleding</li>
<li class="item " data-val="598">Schoenen en Sokken Kinderkleding</li>
<li class="item " data-val="597">Overige Kinderkleding</li>
<li class="item " data-val="579">Bedden</li>
<li class="item " data-val="580">Boxen</li>
<li class="item " data-val="2772">Beddengoed</li>
<li class="item " data-val="2773">Commodes en Kasten</li>
<li class="item " data-val="1670">Complete kinderkamers</li>
<li class="item " data-val="1671">Inrichting en Decoratie</li>
<li class="item " data-val="1951">Kinderspulletjes</li>
<li class="item " data-val="600">Kinderstoelen</li>
<li class="item " data-val="2774">Stapelbedden en Hoogslapers</li>
<li class="item " data-val="2775">Tafels en Stoelen</li>
<li class="item " data-val="619">Traphekjes</li>
<li class="item " data-val="620">Wipstoeltjes</li>
<li class="item " data-val="599">Overige Meubels</li>
<li class="item " data-val="566">Autostoeltjes</li>
<li class="item " data-val="2132">Buggy's</li>
<li class="item " data-val="581">Babydragers</li>
<li class="item " data-val="603">Kinderwagens</li>
<li class="item " data-val="1659">games DS</li>
<li class="item " data-val="2887">games 2DS en 3DS</li>
<li class="item " data-val="2888">games Wii U</li>
<li class="item " data-val="363">games Game Boy</li>
<li class="item " data-val="1730">games GameCube</li>
<li class="item " data-val="1733">games Nintendo 64</li>
<li class="item " data-val="1731">games NES</li>
<li class="item " data-val="1732">games Super NES</li>
<li class="item " data-val="1630">games Wii</li>
<li class="item " data-val="367">games PlayStation</li>
<li class="item " data-val="1734">games PlayStation 2</li>
<li class="item " data-val="1735">games PlayStation 3</li>
<li class="item " data-val="2889">games PlayStation 4</li>
<li class="item " data-val="2890">games PlayStation Vita</li>
<li class="item " data-val="1660">games PSP</li>
<li class="item " data-val="368">games Xbox</li>
<li class="item " data-val="1631">games Xbox 360</li>
<li class="item " data-val="2891">games Xbox One</li>
<li class="item " data-val="1729">games Atari</li>
<li class="item " data-val="365">games Pc</li>
<li class="item " data-val="366">games Sega</li>
<li class="item " data-val="364">games Overige merken</li>
<li class="item " data-val="1655">spelcomputers DS</li>
<li class="item " data-val="2892">spelcomputers 2DS en 3DS</li>
<li class="item " data-val="2893">spelcomputers Wii U</li>
<li class="item " data-val="346">spelcomputers Game Boy</li>
<li class="item " data-val="1736">spelcomputers GameCube</li>
<li class="item " data-val="1739">spelcomputers Nintendo 64</li>
<li class="item " data-val="1737">spelcomputers NES</li>
<li class="item " data-val="1738">spelcomputers Super NES</li>
<li class="item " data-val="1628">spelcomputers Wii</li>
<li class="item " data-val="347">spelcomputers PlayStation</li>
<li class="item " data-val="1740">spelcomputers PlayStation 2</li>
<li class="item " data-val="1741">spelcomputers PlayStation 3</li>
<li class="item " data-val="2894">spelcomputers PlayStation 4</li>
<li class="item " data-val="2895">spelcomputers PlayStation Vita</li>
<li class="item " data-val="1656">spelcomputers PSP</li>
<li class="item " data-val="349">spelcomputers Xbox</li>
<li class="item " data-val="1629">spelcomputers Xbox 360</li>
<li class="item " data-val="2896">spelcomputers Xbox One</li>
<li class="item " data-val="345">spelcomputers Atari</li>
<li class="item " data-val="348">spelcomputers Sega</li>
<li class="item " data-val="1743">spelcomputers Overige merken</li>
<li class="item " data-val="2799">toebehoren DS</li>
<li class="item " data-val="2800">toebehoren Wii</li>
<li class="item " data-val="2801">toebehoren PlayStation</li>
<li class="item " data-val="2802">toebehoren PSP</li>
<li class="item " data-val="2803">toebehoren Xbox</li>
<li class="item " data-val="1657">Overige Toebehoren</li>
......@@ -10,6 +10,8 @@ parser.add_argument("prefix_number", help="Prefix ID (eg. 1)",
args = parser.parse_args()
def special_char_replace(string):
return string.lower().replace("â", "a").replace("ä", "a").replace("à", "a").replace("å", "a").replace("á", "a").replace("ã", "a").replace("ç", "c").replace("ê", "e").replace("ë", "e").replace("è", "e").replace("é", "e").replace("ï", "i").replace("î", "i").replace("ñ", "n").replace("ì", "i").replace("í", "i").replace("æ", "ae").replace("ô", "o").replace("ö", "o").replace("ò", "o").replace("õ", "o").replace("ð", "o").replace("ó", "o").replace("þ", "p").replace("Þ", "p").replace("û", "u").replace("ù", "u").replace("ü", "u").replace("ú", "u").replace("ÿ", "y").replace("ý", "t")
array = []
with open("cat.txt", "r") as ins:
......@@ -21,9 +23,9 @@ with open("cat.txt", "r") as ins:
line = line.replace("</li>", "")
line = line.split("\">")
id = line[0]
name = line[1]
name = name.replace("'", "").replace("!", "").replace("&", "").replace("-", "_").replace(" | ", "_").replace(", ", "_").replace(" en ", "_").replace(":", "_").replace(" ", "_").replace("____", "_").replace("___", "_").replace("__", "_").upper()
id = line[0].replace(" style=\"\"", "")
name = line[1].replace("'", "").replace("!", "").replace("&", "").replace("-", "_").replace(" | ", "_").replace(", ", "_").replace(" en ", "_").replace(":", "_").replace(" ", "_").replace("____", "_").replace("___", "_").replace("__", "_")
name = special_char_replace(name).upper()
data['id'] = id
data['name'] = name
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment