Skip to content

Instantly share code, notes, and snippets.

@yurukov
Last active March 19, 2017 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurukov/0c5fcc3b1d44bb94cda7938a6ddda93f to your computer and use it in GitHub Desktop.
Save yurukov/0c5fcc3b1d44bb94cda7938a6ddda93f to your computer and use it in GitHub Desktop.
Данни за спирките и линиите на градския транспорт във Варна
wget -O stops.json "https://varnatraffic.com/Ajax/GetStations"
echo -n '{"type":"FeatureCollection","features":' > stops.geojson
sed 's_{"id"_\n{"type":"Feature","properties":{"id"_g;s_"text"_"name"_g;s_,"position":{"lat":_},"geometry":{"type":"Point","coordinates":[_g;s_,"lon":_,_g;s_}}_]}}_g' stops.json | sed 's_\[\([0-9.]\+\),\([0-9.]\+\)\]_[\2,\1]_g' >> stops.geojson
echo '}' >> stops.geojson
wget -O site https://varnatraffic.com
grep -o '/bg/Line/Routes/[^"]\+' site | sed 's_.*/__'| sort -un > linenumbers
for i in `cat linenumbers`; do echo -en $i"\t"; wget -q -O - "https://varnatraffic.com/Ajax/GetLineState?line=$i&direction=0" | grep -o '"id":[0-9]\+,"text"' | sed 's_"id":\|,"text"__g' | tr '\n' ',' | sed 's_,$__'; echo ""; done > lines.tsv
line_id stop_list
7 1,32,324,53,51,52,58,15,60,61,63,64,65,66,67,69,319,71,72,73,74,135,375
9 1,49,324,82,83,84,85,86,87,295,88,90,91,92,93,266,267,268,39,270,271,272,273,281,282,283
10 1,49,95,96,97,110,98,99,6
12 62,614,503,625,611,598,610,609,613,551,553,606,510,518,605,604,603,813,602,901,902,903,601
13 1,49,95,116,117,118,119,120,121,189,625,502
14 24,524,128,326,587,586,585,584,583,582,553,191,149,244,245,321,69,70,54,134,912,911,241,216,757,756,755,754,413,233
17 516,198,510,518,605,604,603,813,602,857,858,859,860,927,861,898,899,862,863,864,391,891
18 1,310,32,106,96,140,141,138,142,139,8,75,143,80,57,144,133,45,27
20 16,197,196,20,314,113,109,65,323,264,853,354,855,950,297,414,238,237,236,235,234,825,233
22 1,106,96,140,141,137,138,142,139,8,75,1019,248,240,239,238,237,236,235,234,825,233
23 1,310,148,149,97,110,160,151,158,152,153,154,155,159,156,157,660
24 18,10,148,149,97,110,3,160,151,158,152,153,154,155,159,156,157,2048,2018,2049,2045,2046,2545,2043,2044
25 18,10,148,149,97,110,3,160,151,158,152,153,154,155,159,156,157,2048,2018,2049,2045,2046,2545,2043,2044
26 18,10,32,324,53,51,52,58,15,164,2027,2028,2029,2030,2031,2024,2025,2026
27 18,10,32,324,53,51,52,58,15,164,2027,2028,2029,2030,2031,2024,2025,2026,2032,2035,2036,2037,2038,2039,2042,2040,2041
28 18,10,32,324,53,51,52,58,15,164,2027,2028,2029,2030,2031,2024,2025,2026,2032,2035,2036,2037,2038,2039,2042,2040,2041
29 14,687,686,505,5,684,683,682,681,680,664,663,662,661,679,515,558,552,551,553,191,501
31 1,32,324,53,51,52,58,15,179,161,162,163,164,180,181,182,183,184,5
33 18,10,148,149,97,564,563,561,560,2025,2026,2059,2060,2061,2062,2063,2064
35 18,10,148,149,97,110,160,151,152,153,154,2047
36 370,868,869,367,870,366,365,930,18,10,49,698,501
37 501,310,510,518,930,865,866,371,867,931,369,370,868,872,373,374,876,936,377,378,937
39 305,521,7,204,703,702,701,700,818,49,16,197,196,20,84,85,86,87,129,628,524
40
41 1,106,96,140,141,137,138,142,139,8,574,906,241,216,757,756,755,753,752,751,750,850,851,233
43 533,18,10,148,149,140,141,138,142,139,8,75,143,833,57,80,706,2017,650,709,710,711,2015,2016,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014
46 420,921,169,879,422,423,424,425,393,891,364,363,362,900,398,361,427,360,359,358,357,924,923,922,379,400,421,101,102,313,103,104,105,18,10,698,501
48 77,576,375,575,635,574,912,911,721,743,534,570,569,821,745,596,762,501
49 18,10,148,149,140,141,138,142,139,8,75,650,709,710,711,2015,2016,2002,2003,2004,2005,2019,2020,2021,2022,2023
52 2075,2574,2573,2072,2571,2570,2569,2567,2566,2551,2550,315,211,210,209,150,575,508,639,642,638,641,640,596,762,532,510,518
54 18,10,32,262,96,140,141,138,142,139,8,75,650,709,710,711,815,2050,2051,2052,2053,2054,2055,2056,2057,2058
55 1,310,510,518,605,604,603,813,602,601,888,889,392,390,929
60 516,198,510,518,605,604,603,813,602,857,858,859,860,927,861,898,899,862,863,864,391,882,884,886,905,387,885,883,894,395,396,897
82 233,733,913,254,255,737,738,739,740,748,747,746,634,554,570,569,821,745,944,945,606,698,16
88 233,733,913,254,255,737,738,914,797,417,355,854,353,534,570,569,821,745,944,945,606,532,510,518,605,604,603,813,952
109 1,49,324,82,83,84,85,86,87,295,88,90,91,92,93,266,267,268,277,278,279,280,9,317,271,272,44,185,275,276
117 24,524,128,326,587,586,585,584,520,696,697,516,198,510,518,605,604,603,813,602,857,858,859,860,927,861,898,899,862,863,864,391,891
118 24,524,128,130,131,132,515,558,552,314,113,109,597,244,245,321,69,70,54,134,246,247,248,240,239,238,237,236,235,234,249,250,251,252,253
121 24,524,128,130,131,132,614,503,621,61,63,64,597,244,245,321,69,322,34,243,221,241,240,239,238,237,236,235,234,753,650,709,710,711,815,816,25
131 1,32,324,53,51,52,58,15,632,631,630,295,88,90,91,92,93,94,56,594,269,259,260,261,183,184,5
148 24,524,128,130,131,132,515,558,552,551,553,262,96,140,141,137,263,322,34,243,221,241,240,239,238,237,236,235,234,825,233
209 24,524,128,130,131,132,614,503,612,622,621,61,63,64,65,323,264,243,221,241,240,239,238,237,236,235,234,825,233
409 25,316,315,211,210,209,150,50,43,575,508,639,642,638,641,640,596,762,82,83,84,85,86,87,295,88,90,91,92,93,266,267,268,39,270,317,817,509
1018 1,310,32,106,96,140,141,138,142,139,8,75,143,80,57,144,133,45,27,145,146,46
1118 24,524,128,130,131,132,515,558,552,314,113,109,597,244,245,321,69,70,54,134,246,247,248,240,239,238,237,236,235,234,254,255,256,257,206,80,57,144,133,45,27
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment