#!/bin/bash wget --no-check-certificate -O CANADA.xml -P /data/temp https://download2.iptvboss.pro/ZNLS-2213-GCPB-A8O7-QDK1-GIXS-4MOI-1NFG/xmlonly/CANADA.xml wget --no-check-certificate -O USA.xml -P /data/temp https://download2.iptvboss.pro/R5SQ-4GRG-KK00-0XQT-JZ67-7TSA-D5O7-UC1U/xmlonly/USA.xml ids="/data/xml_tv_ids.txt" raw_can_xml="CANADA.xml" raw_us_xml="USA.xml" output="/data/clean_CANADA_USA.xml" rm /data/clean_CANADA_USA.xml # On cree les filtres pour trouver les channels/programmes qui nous interessent id_filter=$(awk '{printf "@id='\''%s'\'' or ", $0}' "$ids" | sed 's/ or $//') prog_filter=$(awk '{printf "@channel='\''%s'\'' or ", $0}' "$ids" | sed 's/ or $//') # On select avec xmlstarlet les channels et progs qu'on veut et on met ca dans un clean XML { echo '' echo '' xmlstarlet sel -t -n -c "//channel[$id_filter]" "$raw_can_xml" xmlstarlet sel -t -n -c "//channel[$id_filter]" "$raw_us_xml" xmlstarlet sel -t -n -c "//programme[$prog_filter]" "$raw_can_xml" xmlstarlet sel -t -n -c "//programme[$prog_filter]" "$raw_us_xml" echo '' } > "$output" # On format le xml pour un bon indent xmlstarlet fo -t /data/clean_CANADA_USA.xml > /data/cleanest_CANADA_USA.xml