Skip to content

Instantly share code, notes, and snippets.

Created November 29, 2016 16:06
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 anoopdixith/dee7e3c7df989de2a22e19ba679816e8 to your computer and use it in GitHub Desktop.
Save anoopdixith/dee7e3c7df989de2a22e19ba679816e8 to your computer and use it in GitHub Desktop.
Code that gets warnings about traveling to different destinations.
import urllib2, re
from BeautifulSoup import BeautifulSoup
def find_warnings(*urls):
for url in urls:
soup = BeautifulSoup(urllib2.urlopen(url).read())
for a in soup.findAll('a', href=True):
if(a['href'].startswith("/en/") and ":" not in a['href']):
city_soup = BeautifulSoup(urllib2.urlopen("" + str(a['href'])).read())
for elem in city_soup(text=re.compile(r'WARNING:|NOTE:')):
if( == 'td'):
print "\n==========\n" + str(a['href']).split('/')[-1] + "\n" + re.sub('<[^<]+?>', '', str(elem.parent.parent.parent))
if __name__ == '__main__':
url1 = ""
url2 = ""
find_warnings(url1, url2)
Copy link

anoopdixith commented Nov 30, 2016

I find it very interesting to abuse Python to do extremely menial tasks. I call it "Pybuse" ;-)

Pybuse: Using Python in a very hacky, careless way to accomplish a task that's of little practical use.

So I Pybused to find some of the most dangerous cities/places of the world to visit as we were planning our "Dare Tourism"! Because, visiting regular tourist destinations is so mainstream ;-) "Dare Tourism", which is an extreme form of Adventure Tourism and part of Experimental Tourism is where one (or two - to make it more dangerous ;)) visits some of the most unstable, volatile, dangerous places of the world. My idea of an extreme form of Dare Tourism is Erotourism in Dare Tourism where a couple travels to a dangerous place separately and tries to find each other ;-)

It took fifteen minutes and fifteen lines of Python code (above Gist) (example of Pybuse) to find some of the interesting "WARNINGS" about visiting various destinations. Many WARNINGS were rather really intriguing and gives us an insight on how places become dangerous. Islamist Extremism unfortunately is the one that appears in most "WARNING", followed by Zika outbreak. Below are some of the interesting ones I found, some very mild ones.

Some Interesting Ones (Full List is here: , as trying to attach the file made GitHub's bots to think I'm not human :-/)

True that ;-)
NOTE: DO NOT try to take photos of prostitutes even from the streets! Not only is this really rude, you might end up losing your camera without any warning!

This is funny :P
WARNING: Negotiate a price with a rickshaw driver before getting in, or just act like you know and pay the driver upon arrival. Drivers usually don't speak English but there will always be a passer-by to help translate for you.

Very interesting that this is in Bangladesh!
NOTE: The provision for foreigners:From Dated January 7,2015 The home ministry has decided to reinforce the provision of “no free passes” for foreigners visiting the three Chittagong Hill Tracts districts – Rangamati, Khagrachhari and Bandarban. According to above ministry order, the provision for foreigners are need to submit an application to the home ministry a month ahead for their scheduled visit. All non-Bangladeshis are required to register with the local police in Bandarban.

Lol, makes sense :-D
NOTE: Autorickshaws and taxis in Bangalore have a metered fare system. Tipping is neither expected nor required when you avail of autorickshaw or taxi services. Just pay the meter fare. Refrain from tipping and ruining things for the residents who will then be at the receiving end of unwarranted demands for tips.

WARNING: If you are simply passing through Belarus, even if you/your train make no stops, you must obtain a transit visa in advance. The American embassy warns that many customs agents have tried to threaten persons lacking a transit visa with jail or extorted "fines". Such threats are fake. DO NOT give any money to border agents, as they cannot give you a transit visa or charge fees; they can only refuse entry to you. If you did pay the border agents and they allowed you to enter without a visa in your passport, contact your embassy or consulate immediately, as trying to exit the country without a proper visa will lead to fines and even imprisonment.(22 May 2015)

Wow! Didn't know INR could be used in Bhutan and that they were the first to ban Indian 500 and 1000 notes :P
NOTE: Although Indian currency is legal tender in Bhutan, the Royal Monetary Authority of Bhutan has issued a notice banning the use of Indian 500 rupee and 1000 rupee notes. Nonetheless, as of Oct 2009, the 500 rupee note is largely accepted by most locals. Government owned establishments do not accept the aforementioned notes, and hence it is advisable to carry sufficient currency in either Bhutanese currency or in the form of Indian 100 rupee notes. If you are carrying denominations of Rs 500 and Rs 1000, there is a limit of Rs 25,000 in these denominations per person imposed by Reserve Bank of India [12].

So cute ;)
WARNING: This area of the mountains has little to no cell-phone reception - please keep that in mind as you make your plans to visit the area.

WARNING: Be aware that due to the constant landmine threat it is better not to leave the paved road, even for a pee-break in areas where you are not familiar with; See #Stay safe(22 May 2015).

WARNING: Homosexual acts are illegal, with death by stoning being the punishment. The introduction in 2014 of an Islamic Criminal Code, means any convicts that engage in homosexuality acts that have been testified to by four honest-in-character witnesses to the court would be punishable by death if proven to a jury's satisfaction. Police will join in or turn a blind eye to violence toward LGBT. Businesses will turn you away, attack you, or report you to the police. If you're LGBT stay out of Brunei.

Lol, China :-D
WARNING: As of September, 2014, Google Search, Gmail, Google Map and Google Translate all cannot be accessed in China without a VPN. Before you come to China, better redirect your Gmail account to another email service such as Hotmail. Travellers may switch to for search engine and Bing Maps for map service. If you prefer to subscribe a VPN service, please be aware that the websites of many major providers, including StrongVPN, Astrill or Ninja VPN are blocked although their services are still working. (26 May 2015)

WARNING: Stay on roads, the radiation levels on areas covered by vegetation are significantly higher. Even more important, the risk for contamination when walking amongst vegetation is higher because it is more difficult to avoid touching or inhaling anything. Radiation ends when you leave the place, but you don't want radioactive elements inside your body.
Follow common sense if you are on your own; if you see an area marked with a radiation sign, the meaning is clear: DON'T GO THERE.

NOTE: Dahab's most infamous dive site is the Blue Hole, 107 meters deep with an arch opening onto the reef face at 58 meters. This site is considered to be the most dangerous scuba diving site on earth, regularly killing inexperienced and experienced divers foolish enough to risk it. A high number of instructors and divemasters have met their fate in the Blue Hole, as well, including many who had successfully passed the arch dozens of times. Should you be interested in descending to the arch you MUST go through technical dive training and visit the Blue Hole on the correct gases. Diving this site on air alone is near suicidal, so even if a very experienced person offers to take you through, do not at any price do this unless you have technical training and are using it.

I really want to visit this place.
WARNING: East St. Louis is most emphatically NOT a tourist destination. The city features as having the highest crime rate in the United States in the FBI's 100 most dangerous cities list and is perceived by many as "America's most dangerous city".

Poor Swedes :-/
NOTE: January 4th, 2016: Due to political pressure as a result of the large numbers of immigrants, the Swedish government has decided a valid ID is required to board any international train, bus or ferry bound for Sweden from Denmark. This is in effect until further notice.

If you overstay for three days, you'd be made to overstay for three years :-)
NOTE: Overstaying is a serious offence - you can be fined up to $50,000 and/or imprisoned for up to three years.

That's so sweet :)
NOTE: The River Rail streetcar tracks on Markham, Second, and Third Streets near the River Market and Clinton Library in downtown Little Rock and Main and Maple Streets in North Little Rock present a hazard to street parking. It would probably be wise to walk or ride the trolleys to visit these streets.

Whoa, didn't think it would be a criminal offence in Liverpool!
WARNING: It can be a criminal offence to travel on a bus or train without a valid ticket. Revenue Protection Inspectors do operate frequently, particularly on the local rail services.

WARNING: Non-Muslims are strictly prohibited from entering the city of Mecca. The penalty is deportation from the country. Documentation will be checked upon entry and anyone not showing proof of being Muslim will be denied entry. As a solitary exception, the Mecca bus terminal (outside city limits) is open to all.

This was expected.
WARNING: Under no circumstances are you to say anything that could be perceived as an insult to or critical of Kim Il-sung, Kim Jong-Il, Kim Jong-Un, the Juche ideology, the Songun policy, the ruling Worker's Party of Korea, the North Korean government in general, or the citizens of North Korea

WARNING: The flag of Saudi Arabia bears the Islamic declaration of faith, and desecration or any other inappropriate use of the flag is considered a crime. Any criticism of the King, the royal family, Islam or Saudi Arabia's government in general is not tolerated and risks indefinite imprisonment or execution.

WARNING: Under no circumstances, insult King Mswati III or the royal family of Swaziland. Activism is brutally dispersed and people are reported to be shot and to be brutally injured from doing this! Do not attend ANY of the political demonstrations that happen occasionally.

Never imagined there could be a dry place in Alaska!
NOTE: The sale or purchase of alcohol is banned in Barrow, although importation (by permit only) and possession is allowed. [5]

This is a terribly smart idea :-D If you drive a private bus, make it appear like a government bus.
WARNING: Beware of fake public buses!!! (e.g., Bus C72 from the East Bus Station)
Be aware that there are some fake "public buses". The price is the same, the bus number is the same, the bus color is the same! But the bus is a bit dirty and old, the driver uses a speaker, and the bus doesn't have a schedule but just waits until it's full to leave. It takes local and cycle roads and arrives at the dirty rear area of the train station instead of the main bus area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment