Commit 642ad931 authored by Melroy van den Berg's avatar Melroy van den Berg

Add argparser + more categories

parent b7786a8d
This diff is collapsed.
#!/usr/bin/env python3
# Marktplaats batch script
# By: Melroy van den Berg
__version__= 1.0
import argparse
from marktplaats import Marktplaats
from text_color import TextColor
from category import MP_Category
__version__= 1.0
parser = argparse.ArgumentParser(description="Batch process advertisements.")
parser.add_argument("-c", "--categories", help="List of all Marktplaats categories and exit.",
parser.add_argument("-a", "--approval", help="Approval required to submit",
parser.add_argument('--version', action='version', version='%(prog)s {version}'.format(version=__version__))
args = parser.parse_args()
# Shipping trick only works in Chrome not in Firefox! Arrrg! Try setting hidden fields via javascript instead or other hacking when required.
# True, user need to press the button him/herself. False, the system automatically press the button after uploading pictures.
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)
for c in MP_Category:
print (TextColor.OKGREEN + "INFO: Running Marktplaats Batch %s" % str(__version__) + TextColor.ENDC)
if args.approval:
print (TextColor.OKGREEN + "INFO: User approval still required before placing the advertisement.\n" + TextColor.ENDC)
<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>
......@@ -23,7 +23,7 @@ with open("cat.txt", "r") as ins:
line = line.split("\">")
id = line[0]
name = line[1]
name = name.replace("'", "").replace("-", "_").replace(" | ", "_").replace(", ", "_").replace(" en ", "_").replace(" ", "_").replace("____", "_").replace("___", "_").replace("__", "_").upper()
name = name.replace("'", "").replace("!", "").replace("&", "").replace("-", "_").replace(" | ", "_").replace(", ", "_").replace(" en ", "_").replace(":", "_").replace(" ", "_").replace("____", "_").replace("___", "_").replace("__", "_").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