def test_get_from_url(self): # naver disabled ''' url, is_created = Url.get_or_create_smart('http://map.naver.com/local/siteview.nhn?code=21149144') self.assertEqual(LegacyPlace.get_from_url(url).content, '21149144.naver') url, is_created = Url.get_or_create_smart('http://map.naver.com/?app=Y&version=10&appMenu=location&pinId=31130096&pinType=site&lat=37.3916387&lng=127.0584149&title=능이향기&dlevel=11') self.assertEqual(LegacyPlace.get_from_url(url).content, '31130096.naver') url, is_created = Url.get_or_create_smart('http://m.store.naver.com/restaurants/detail?id=37333252') self.assertEqual(LegacyPlace.get_from_url(url).content, '37333252.naver') url, is_created = Url.get_or_create_smart('http://m.map.naver.com/siteview.nhn?code=31176899') self.assertEqual(LegacyPlace.get_from_url(url).content, '31176899.naver') url, is_created = Url.get_or_create_smart('https://m.map.naver.com/viewer/map.nhn?pinType=site&pinId=21652462') self.assertEqual(LegacyPlace.get_from_url(url).content, '21652462.naver') url, is_created = Url.get_or_create_smart('https://m.map.naver.com/siteview.nhn?code=11523188&ret_url=https%3A%2F%2Fm.search.naver.com%2Fsearch.naver%3Fwhere%3Dm%26query%3D%25EC%259C%2584%25EB%258B%25B4%25ED%2595%259C%25EB%25B0%25A9%25EB%25B3%2591%25EC%259B%2590%26sm%3Dmsv_nex%23m_local') self.assertEqual(LegacyPlace.get_from_url(url).content, '11523188.naver') ''' url, is_created = Url.get_or_create_smart('http://place.kakao.com/places/14720610') self.assertEqual(LegacyPlace.get_from_url(url).content, '14720610.kakao') url, is_created = Url.get_or_create_smart('http://m.map.daum.net/actions/detailInfoView?id=15493954') self.assertEqual(LegacyPlace.get_from_url(url).content, '15493954.kakao') url, is_created = Url.get_or_create_smart('http://m.map.daum.net/actions/detailInfoView?id=15493954') self.assertEqual(LegacyPlace.get_from_url(url).content, '15493954.kakao') url, is_created = Url.get_or_create_smart('http://place.map.daum.net/26799590') self.assertEqual(LegacyPlace.get_from_url(url).content, '26799590.kakao') url, is_created = Url.get_or_create_smart('http://foursquare.com/v/4ccffc63f6378cfaace1b1d6') self.assertEqual(LegacyPlace.get_from_url(url).content, '4ccffc63f6378cfaace1b1d6.4square') url, is_created = Url.get_or_create_smart('https://ko.foursquare.com/v/방아깐/4ccffc63f6378cfaace1b1d6') self.assertEqual(LegacyPlace.get_from_url(url).content, '4ccffc63f6378cfaace1b1d6.4square') url, is_created = Url.get_or_create_smart('http://ko.foursquare.com/v/4ccffc63f6378cfaace1b1d6') self.assertEqual(LegacyPlace.get_from_url(url).content, '4ccffc63f6378cfaace1b1d6.4square') url, is_created = Url.get_or_create_smart('https://www.mangoplate.com/restaurants/f-YvkBx8IemC') self.assertEqual(LegacyPlace.get_from_url(url).content, 'f-YvkBx8IemC.mango') if not WORK_ENVIRONMENT: url, is_created = Url.get_or_create_smart('https://www.google.com/maps/place/Han+Ha+Rum+Korean+Restaurant/@22.3636765,113.4067433,9z/data=!4m8!1m2!2m1!1z7Iud64u5!3m4!1s0x34040056de2d51b3:0xae100fb893526bdf!8m2!3d22.2801408!4d114.182783') self.assertEqual(LegacyPlace.get_from_url(url).content, 'ChIJs1Et3lYABDQR32tSk7gPEK4.google')
def add_lps_from_urls(self): if self.urls: for url in self.urls: lp = LegacyPlace.get_from_url(url) if lp and lp not in self.lps: self.lps.append(lp)