-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbajar.sh
executable file
·144 lines (126 loc) · 4.89 KB
/
bajar.sh
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
# convierte en rss
##############################################################################
## TELEFE
function telefe() {
echo telefe
telefeshow $1/srespapis 80295
telefeshow $1/masterchef 123984
telefeshow $1/somosfamilia 12174
telefeshow $1/peligrosincodificar 10592
}
#recibe un string que tiene un json y saca una lista de urls de capitulos
# saca una lista como
# http://telefe.com/masterchef/masterchef-programa-1-(06-04-2014)/
# http://telefe.com/sres-papis/sres-papis-capitulo-64-(29-04-2014)/
function tocapitulourl() {
# "{\"PageNumber\":\"1\",\"ItemsPerPage\":\"12
sed 's/\\\"/"/g'| #"{"PageNumber":"1","ItemsPerPage":"12",
sed 's/^"//g'|
sed 's/"$//g'| # {"PageNumber":"1","ItemsPerPage":"12",
python -m json.tool|
grep '"Link":'|
cut -d'"' -f4
}
# recibe un link como
# http://telefe.com/masterchef/masterchef-programa-1-(06-04-2014)/
# y retorna una fecha en formato ISO-DATE
function link2date() {
awk 'BEGIN{FS="/"}{print $(NF-1)}'| # masterchef-programa-4-(27-04-2014)
awk 'BEGIN{FS="("}{print $(NF)}' | # 27-04-2014)
awk 'BEGIN{FS=")"}{print $1}' | # 27-04-2014
awk 'BEGIN{FS="-"}{print $3"-"$2"-"$1}' # 2014-04-27
}
function telefeshow() {
curl -s "http://telefe.com/umbraco/surface/TelefeMicrositiosSurface/GetVerMas?categoryId=11&nodeId=$2&page=" > .x || exit 1
cat .x|tocapitulourl > .links
# en links hay links de la forma
# http://telefe.com/sres-papis/sres-papis-capitulo-65-(30-04-2014)/
for i in `cat .links`; do
d=`echo $i|link2date`
prefix="$1/$d"
out=${prefix}.html
xml=${prefix}.xml
if [ ! -e $out ]; then
if [ ! -e $xml ]; then
echo $i to $out
curl -s $i > .tmp
mv .tmp $out
fi
fi
if [ ! -e $xml ]; then
img=`cat $out|grep 'og:image'|sed 's/^.*content="//g'|cut -d'"' -f1`
title=`cat $out|grep '<meta name="description"'|sed 's/^.*content="//g'|cut -d'"' -f1|sed 's/(.*$//g'|cut -d- -f2-|cut -b2-`"($d)"
mp4url=`cat $out|egrep 'edgesuite'|cut -d'"' -f 4`
descr=`cat $out |grep 'og:description'|sed 's/^.*content="//g'|cut -d'"' -f1`
cat << EOF | xmllint --format --nocatalogs - |sed 1d > .tmp
<item sdImg="${img}"
hdImg="${img}">
<title>${title}</title>
<streamFormat>mp4</streamFormat>
<media>
<streamUrl>${mp4url}</streamUrl>
</media>
<synopsis>${descr}</synopsis>
</item>
EOF
mv .tmp $xml
rm $out
fi
o="$1/index.xml"
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' > $o
echo '<feed>' >> $o
ls $1/2*.xml|sort -r|head -n 20|xargs cat >> $o
echo '</feed>' >> $o
done
}
###############################################################################
content="content"
telefe $content/telefe
echo trece
./eltrece.py > content/eltrece/index.xml
out="$content/categories.xml"
base="http://tvar.s3.amazonaws.com"
cat << EOF > $out
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<categories>
<category title="Todo Noticias"
description="TN"
sd_img="$base/tn/logo.png"
hd_img="$base/tn/logo.png">
<categoryLeaf title="TN"
description=""
feed="$base/tn/index.xml"/>
</category>
<category title="Telefe"
description="LS 84 TV Canal 11 de Televisión
argentina,transmitiendo desde la ciudad de Buenos Aires"
sd_img="$base/telefe/logo.png"
hd_img="$base/telefe/logo.png">
<categoryLeaf title="Mastercheff"
description=""
feed="$base/telefe/masterchef/index.xml"/>
<categoryLeaf title="Sres Papis"
description=""
feed="$base/telefe/srespapis/index.xml"/>
<categoryLeaf title="Somos Familia"
description=""
feed="$base/telefe/somosfamilia/index.xml"/>
<categoryLeaf title="Peligro sin codificar"
description=""
feed="$base/telefe/peligrosincodificar/index.xml"/>
</category>
<category title="El Trece"
description="LS 85 TV Canal 13 de Televisión argentina, transmitiendo desde la ciudad de Buenos Aires"
sd_img="$base/eltrece/logo.png"
hd_img="$base/eltrece/logo.png">
<categoryLeaf title="Últimos capitulos"
description=""
feed="$base/eltrece/index.xml"/>
<categoryLeaf title="Vivo"
description=""
feed="$base/eltrece/vivo.xml"/>
</category>
</categories>
EOF
s3cmd sync -c ~/.s3cfg-leak -P --exclude=201* content/ s3://tvar/