Skip to content

Instantly share code, notes, and snippets.

@yshalsager
Created April 10, 2018 11:37
Show Gist options
  • Save yshalsager/68a612184860c760da9520d635bfc439 to your computer and use it in GitHub Desktop.
Save yshalsager/68a612184860c760da9520d635bfc439 to your computer and use it in GitHub Desktop.
Fetch miui latest stable
261,HM2XWC_
261,HM2XWCPro_
263,MI4iGlobal_
273,MINotePro_
293,MI4c_
297,HMNote1S_
297,HMNote1SGlobal_
298,HM3_
298,HM3Global_
299,MI5_
299,MI5Global_
300,MI4s_
301,HMNote3Pro_
301,HMNote3ProGlobal_
301,HMNote3ProtwGlobal_
302,MIMAX_
302,MIMAX652_
302,MIMAX652Global_
302,MIMAXGlobal_
303,HM3S_
303,HM3SGlobal_
304,HMPro_
309,HMNote4_
309,HMNote4Global_
309,HMNote4XGlobal_
314,MI5S_
314,MI5SGlobal_
315,MI5SPlus_
315,MI5SPlusGlobal_
316,MINote2_
316,MINote2Global_
317,MIMIX_
317,MIMIXGlobal_
318,HM4_
319,HM4A_
319,HM4AGlobal_
320,HM4Pro_
321,HMNote4X_
323,HM4X_
323,HM4XGlobal_
325,MIPAD3_
326,MI6_
326,MI6Global_
328,MIMAX2_
328,MIMAX2Global_
329,MI5X_
332,HMNote5A_
332,HMNote5AGlobal_
332,HMNote5ALITE_
332,HMNote5ALITEGlobal_
334,MIMIX2_
334,MIMIX2Global_
336,MINote3_
338,HM5A_
340,HM5_
340,HM5Plus_
341,WHYREDGlobal
cat devices | while read device; do
id=$(echo $device | cut -d , -f1)
name=$(echo $device | cut -d , -f2)
echo Device: $(cut -d _ -f1 <<< $name) >> data ; echo id: $id >> data
if [[ $name = *"Global"* ]]; then
curl -s http://en.miui.com/download-$id.html | grep 'margin-top: 0' | cut -d '"' -f6 | cut -d / -f4 | head -n1 >> data
else
curl -s http://en.miui.com/download-$id.html | grep 'margin-top: 0' | cut -d '"' -f6 | cut -d / -f4 | head -n3 | tail -n1 >> data
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment