I'm practicing web-scraping and trying to grab the reviews from the following page: https://www.yelp.com/biz/jajaja-plantas-mexicana-new-york-2?osq=Vegetarian+Food
This is what I have so far after inspecting the name element on the webpage:
page = requests.get('https://www.yelp.com/biz/jajaja-plantas-mexicana-new-york-2?osq=Vegetarian+Food', headers={'User-Agent':'Mozilla/5.0'}).text
parsed_page = BeautifulSoup(page, 'lxml')
# print(parsed_page)
for x in parsed_page.find_all('a', class_='css-1422juy'):
print(x)
But it doesn't seem to be working, the output is not the name but:
<a class="css-1422juy" href="/c/mexican">Mexican</a>
<a class="css-1422juy" href="/c/vegan">Vegan</a>
<a class="css-1422juy" href="/c/bars">Bars</a>
<a class="css-1422juy" href="https://www.yelp.com/menu/jajaja-plantas-mexicana-new-york-2" role="link">View full menu<span class="display--inline__09f24__c6N_k margin-l1__09f24__m8GL9 border-color--default__09f24__NPAKY"><span aria-hidden="true" class="icon--14-chevron-right-outline css-mpwjkl"><svg class="icon_svg" height="14" width="14"><path d="M5.043 11.5a.498.498 0 00.353-.146L9.75 7 5.396 2.646a.5.5 0 00-.707.708L8.336 7l-3.647 3.646a.502.502 0 00.354.854z"></path></svg></span></span></a>
<a class="css-1422juy" href="/questions/XipQLDbyTl5tsLlyzAWzug" role="link">Ask a question<span class="display--inline__09f24__c6N_k margin-l1__09f24__m8GL9 border-color--default__09f24__NPAKY"><span aria-hidden="true" class="icon--24-add-v2 css-106vfgv"><svg class="icon_svg" height="24" width="24"><path d="M19 11h-6V5a1 1 0 10-2 0v6H5a1 1 0 100 2h6v6a1 1 0 102 0v-6h6a1 1 0 100-2z"></path></svg></span></span></a>
If I use html.parser and .prettify() instead the parsed output of the name, rating, and review fields in the the console looks pretty different:
<script type="application/ld+json">
{"#context":"https://schema.org","#type":"Restaurant","name":"Jajaja Plantas Mexicana","image":"https://s3-media0.fl.yelpcdn.com/bphoto/OkWKXxOZBLJO7hRjOlIMig/l.jpg","priceRange":"$11-30","telephone":"(646) 883-5453","address":{"streetAddress":"162 E Broadway","addressLocality":"New York","addressCountry":"US","addressRegion":"NY","postalCode":"10002"},"review":[{"author":"Caroline J.","datePublished":"2021-11-24","reviewRating":{"ratingValue":5},"description":"I typically don't write reviews for restaurants, but I'll make an exception! I have been vegan for almost 4 years now and meatless for about 8 years now. My sister told me about this place and we didn't get a chance to go until last night. My sister is non-vegan, my mom is also non-vegan. I went with my sister, and we got food to share. My sister who is a very skeptical about vegan food absolutely loved it. My mom who is also skeptical about vegan food had my sisters leftovers and absolutely loved it as well! Everything was delicious and I love the atmosphere in the restaurant as well! Definitely will be going back because they have other stuff on the menu I want to try! It's both vegan and non vegan approved for a 100% vegan Mexican restaurant!!"},{"author":"Melissa W.","datePublished":"2021-12-24","reviewRating":{"ratingValue":5},"description":"The food was great. I went with my partner for a birthday dinner and while I have adopted a plant based lifestyle, he has not but he enjoyed EVERYTHING that we ordered."},{"author":"Sooji L.","datePublished":"2022-01-09","reviewRating":{"ratingValue":5},"description":"NACHOS NACHOS NACHOS ($18 with guac). I prefer having these nachos than other nachos that aren't vegan. Soooooooo gooooood. I have to say that to pay extra $3 for guac, they can add more than just a scoop. The portions are enough for 3 people! \n\nFish tacos were great. Replaced with squash and flavorful all together. $9 for two tacos. You may add an extra taco for an extra $3/4 bucks. \n\nMy husband ordered the Gorditas. The shell was so crunchy and good. It was supposed to have "bacon" but it was quite underwhelming. Wouldn't quite recommend this dish.\n\nBoth drinks were delish! Almond horchata... I would get that the next time I come back. It is a bit gritty though.\nI ordered the matcha y coconut cocktail. Cocktails are $$. It was $15. Some drinks can be turned into a mock tail for the same price which I find that to be unreasonable. Regardless, the drinks are worth getting.\n\n****ASK FOR HOT SAUCE! and you'll get three choices. I love my hot sauce and the variety they provided. The mild (orange) was my favorite. \n\n(Rating was not based on this following experience) on our visit, there was a homeless man in their outdoor seating area which we were able to view from our seat inside. At some moments, he pulled down his pants. Not pleasant, I'd say. The staff did try to remove him but he did not budge. I hope they reached out to homeless services. He was there during our entire dining experience. \n\nMy rating is purely on the food and service. That situation was out of their control but do please keep in mind that the neighborhood is not the best area. They do have multiple locations so please consider checking them out."},{"author":"Roshni P.","datePublished":"2021-11-11","reviewRating":{"ratingValue":5},"description":"I was skeptical because I am from Southern California and Mexican has to hit right for me. But holy crap this is amazing!!!! \n\nBirria tacos was our least favorite but that's not saying much because I would give it 9.5/10 \n\nBurrito was 10/10 . As you eat it there is more and more flavor and so so good! I like the red sauce side more \n\nNachos is hands down the best item!!! Plenty of food for your meal. I would give it a 11/10. The chorizo is soo good. Ask for hot sauces on the side. The orange one is really good"},{"author":"Whitney L.","datePublished":"2021-11-03","reviewRating":{"ratingValue":5},"description":"This place hits the spot on so many levels.\n\n Service was attentive, efficient and personable. Check!\n\nFood---outstanding. I ordered the Tavon Taco bowl, pumpkin and beet empanada and the Matcha and Coconut Cocktail. Everything was delicious and seasoned well. If you like matcha, don't sleep on that Matcha +Coconut Cocktail....OUTSTANDING. Everything tasted truly unique---like something you can't get other places. And even better, lots of veggies and healthy options. Double- check!!\n\nTheir homemade chorizo is yum yum yum. Make sure to try that!\n\nDecor and ambiance was fun, colorful and on brand. This place has great energy. Highly recommend and can't wait to go back."},{"author":"Johnny G.","datePublished":"2021-12-27","reviewRating":{"ratingValue":4},"description":"The nachos are to die for. Unbelievable, so clean and not heavy. Couldn't tell the difference from any carnivorous nacho I've had. I loved it and wished I stopped there.\nI had the Coconut Queso Quesadilla and wasn't really a fan. Tasted like a pasta dish (heavy on the pesto) and it had a sweetness. Nonetheless great food overall."},{"author":"Kathy X.","datePublished":"2021-09-25","reviewRating":{"ratingValue":4},"description":"Recently, I came here with a friend for lunch. I was looking forward to trying plant-based food and drink. The interior was lovely, bright, and modern. There is a fully stocked bar with plants all around, orange lights dropping down from the ceiling, and nice wood tables. \n\nFor my meal, I ordered Almond Horchata (always have to get the Horchata if it's on the menu), Crispy Chayote Fish, and Enchiladas Mole. I also got to try my friend's Chorizo Nachos and Mexican Street Corn. \n\nThe Almond Horchata came in a wine glass with a beautiful deep purple orchid flower. The color of the drink was pale brown with bits of coconut on top. It was delightfully creamy, cinnamon-y, and sweet. \n\nChayote Fish consisted of hemp and flax seed buttered squash, and the taco also came with chipotle almond butter and red onion. The squash was fried to perfection in a deliciously well-seasoned batter, and truly resembled the taste of fish. The chipotle-flavored butter added a depth of flavor to the tacos, while the red onion gave it an additional crunch and fresh element. \n\nEnchiladas Moles had shredded palm carnitas, coconut queso, guajillo, sour cream, and also came with Spanish rice. This was absolutely wonderful! The palm carnitas was tender, succulent, with plenty of flavorful spices. The sauce that accompanied the enchiladas was yummy as well. In addition, the Spanish rice was cooked well. \n\nNachos came with plant based chorizo, fermented black beans, corn, turmeric, queso fundido, and sour cream. What a mouthwatering medley of flavors that mingled together to create very tasty bites. The chorizo was juicy, succulent, and packed with bold flavor. The cheese sauce with the sour cream was addicting and was well distributed throughout all the chips. \n\nThe Mexican Street Corn was covered with a powdery type of cheese, and slightly charred (which is how I like it) and was good. \n\nService was top notch. Our waiter was friendly and kind. Everything was made with such care and attention to detail. I also loved the unique menu offerings. I would definitely like to return and try the Coconut Queso Quesadilla, and perhaps the Peanut Chocolate Cake."},{"author":"Alissa M.","datePublished":"2022-01-09","reviewRating":{"ratingValue":4},"description":"Came here for lunch with my wife on a Saturday afternoon. The restaurant is absolutely adorable inside! I love the plants and the decor all throughout. The nachos are to die for! Definitely the best nachos I have had since becoming dairy free. The coquito was also very good! The display of the chorizo burrito and barbacoa tacos was cute but I wasn't a huge fan of the texture of the barbacoa or the flavor of the protein inside the burrito. We will definitely be back for the Nachos and I must try the mini churros next time!"},{"author":"Steven Z.","datePublished":"2021-08-12","reviewRating":{"ratingValue":5},"description":"Great Mexican food with a cool interior playing Hispanic music which made for a nice ambience. Prices are fair\n\nMy friend and I were starving after a long day and ordered a lot of food: nachos, chorizo burrito, fish tacos and a quesadilla. \n\nThe nachos (with guac) were really good and made for a great appetizer, the chorizo burrito was delicious (but very messy since it's covered in sauce), the quesadilla was really good too. But the highlight of the meal was the fish tacos - nice crispy outside but soft and yummy inside. If I had to get one dish again, it'd be the fish taco. \n\nThe frozen agave margarita was a refreshing as well; it's pretty strong so you'll definitely taste the alcohol."},{"author":"Lily C.","datePublished":"2021-10-30","reviewRating":{"ratingValue":5},"description":"We got the fish tacos, carnitas, nachos with guacamole, and churros! Everything was so good and we couldn't believe it was all vegan! My boyfriend and I are both meat eaters, but we noticed that we didn't feel sluggish/sleepy (as we would with our non-vegan meals) after finishing our food. Definitely get the churros if you're craving for something sweet after your meal! \n\n5/5 Highly recommend whether you're a vegan or not! :D"},{"author":"Rebecca R.","datePublished":"2021-12-26","reviewRating":{"ratingValue":5},"description":"Yummy food. Inventive and interesting. Wide variety. The nachos were great. Good sized portions. Accommodating for preferences and such. Even the kiddos loved it!"},{"author":"Shubhi M.","datePublished":"2021-07-18","reviewRating":{"ratingValue":5},"description":"I've never tried a vegan mexican food that tasted this good. It's crazy some of the vegan taco options they had (birria, carnitas, chorizo, barbacoa, and fish), I have never had an opportunity to try vegan version of those dishes. I've never had barbacoa or fish but I can imagine this is may somewhat taste like. It was almost a weird (but definitely good) experience how meaty the texture was of the tacos. \n\nThe nachos were beyond amazing, a pet peeve of mine is when I get served a bunch of chips with toppings only on the top and the bottom of the pile is just plain chips but these were perfectly layered with so much vegan chorizo. They recently opened a location in a whole food which is very close to me so i'm definitely going to go back!"},{"author":"Likitha M.","datePublished":"2021-08-11","reviewRating":{"ratingValue":4},"description":"My friend picked out this place for us to try and I didn't realize that it was all plant-based until our waitress mentioned it. We didn't have a reservation but we were seated as soon as we walked in and given a QR code to scan for the menus. \n\nIt felt like there were so many options to choose from but we ultimately narrowed it down and ordered the nachos with added guac, chayote "fish" tacos, chorizo tacos, barbacoa tacos, and almond horchata. We LOVED the nachos -- the chips were nice and crispy and all the toppings were so cohesive. There was a really good topping/chip ratio so we never ran out of one or the other. In addition, the sauces added were delicious -- if you come by and only want one thing to order, get the nachos!! The tacos were all so flavorful and delicious as well, but so small and expensive. I personally don't think they were worth $8 for 2 tacos, especially if it only took like 3 bites to consume but I understand the pricing as it is vegan and located in NYC. Finally, the horchata was very refreshing and I loved it! \n\nOverall, they had really delicious food and it was a pretty decent experience for my first time having an all plant-based meal!"},{"author":"Fionna L.","datePublished":"2021-07-14","reviewRating":{"ratingValue":4},"description":"Link to menu: https://qrcgcustomers.s3-eu-west-1.amazonaws.com/account8682491/15091203_1.pdf?0.4352589218767642 \n\n(4.5/5) The lively, communal atmosphere made eating here a pleasure! We sat at the bar so service was slower but never neglectful. Their nachos and tacos are must-trys and great to share with friends!\n\n - Nachos: $13 + $3 guac: the BEST plant-based nachos I've had! Their chorizo was chewy and flavorful, the fermented black beans were yum and very filling, and the guac was definitely worth it for added depth and creaminess. Small thing, but I wish they had more than just a couple red and purple nachos.\n - Chorizo Burrito: $13: too salty! We could barely taste the ingredients or differentiate the sauces because salt dominated the flavor of every bite. Quite disappointed in this one. \n - Crispy Chayote Fish Tacos (2): $8: how ingenious to use "hemp & flax seed battered squash" as a substitute for fish! The description sounds sophisticated but it tasted very much like BBQ Lay's, even down to the delicious crunch. Due to the strength of its flavorings, we couldn't taste any of the squash's original flavor. The ring of red onion was aesthetic but would have been easier to eat if chopped.\n\nSide note: their restrooms downstairs demonstrate how they turn rustic elements unique through modern and innovative design. \n\nAll in all a great experience, though I wouldn't recommend the burrito. Would love to go back to try the Coconut Queso Quesadilla and Spicy Birria Tacos!!"},{"author":"Sharon J.","datePublished":"2021-10-16","reviewRating":{"ratingValue":4},"description":"Kinda overrated food, but great vibes! Pretty good for a vegan restaurant, but I've had better vegan food and Mexican food. \n\nI got the chorizo burrito but it was very salty with not a lot of other flavor besides that - almost as if they were using salt to cover up the lack of flavor. Definitely very pretty food though, nice interior, and great service - just wish the food was more flavorful. Maybe I'll try the tacos next time and see if those are better..."},{"author":"Srini V.","datePublished":"2021-09-24","reviewRating":{"ratingValue":5},"description":"I have been meaning to visit this location of Jajaja for some time now. And the opportunity presented itself as a few of us were looking for a neighborhood restaurant in the middle of a torrential downpour.\n\nWe chose to take a table inside. The QR code for their menu was pasted on the wall by our table. We had the guacamole y chips to start. I then got the sopa del día, which happened to be a green soup (sopa verde). This was the highlight of my meal. The soup was thick, had a generous sprinkling of hot sauce and was just perfect, especially after the rain. I then had the chipotle sweet potato street tacos that were delicious ... the fermented beans made for a hearty filling.\n\nGreat service. Nice ambiance. Everyone was happy with their food and drinks. I will be back soon!"},{"author":"Julianna Y.","datePublished":"2021-09-29","reviewRating":{"ratingValue":5},"description":"This place is DELICIOUS! I've been ordering my lunch here for a while now, and I have to say that everything I've had has been so good! This is a vegan Mexican heaven for foodies! Things you should order when you come here are: \n\n-Turmeric Cauliflower Rice \n-Taco Tazón bowl \n-Nachos! \n-chorizo Burrito \n\nAside from these yummy dishes, their hot sauces are amazing! Definitely recommend getting the mild (orange) and black bean sauce!"},{"author":"Saasha G.","datePublished":"2021-09-14","reviewRating":{"ratingValue":4},"description":"I have became a certified vegan food lover! Never have I tasted such great food and no meat in anything. I was astonished at the flavors. This was my first time dining here and I will return. The place is small and minimal decor but honestly I don't care just give me the food!"},{"author":"Edward K.","datePublished":"2021-11-20","reviewRating":{"ratingValue":5},"description":"My friend and I get dinner once a month, we alternate choosing and this month my friend selected Jajaja. We arrived a half hour before our 6:45 reservation on a Thursday. The gentleman at the door was able to get us seated right away.\n\nThe restaurant has a trendy vibe, cool furniture and lighting. We did get wedged into a slightly uncomfortable corner table but it may have been uncomfortable mainly because I'm on the taller side.\n\nThe goal of our monthly outings is to continually challenge our palates. We've had the vegan/vegetarian genre before but we hadn't tried vegan Mexican before. The menu is cool, lots of choices that are able to be shared. We selected 5 starters, 2 entree style dishes, and three tacos. The heart of palm ceviche was very fresh. The beet and pumpkin empanada was piping hot and flavorful. I enjoyed the tamale with jackfruit. The Gordita and Burrito entrees were pretty substantial and also tasty. We found the tacos to be a highlight, the cauliflower especially. The birria and "fish" tacos were also quite nice, the birria was perhaps the dish with the most kick and the "fish" had a good texture.\n\nService was solid throughout the meal. Although we ate a solid amount of dishes for two people, I didn't feel overstuffed. Definitely a place worth returning to."},{"author":"Pamela L.","datePublished":"2021-02-15","reviewRating":{"ratingValue":4},"description":"As I was walking to my mom's place, this new restaurant stopped me in my tracks. OMG...I remember that this spot used to be a Chinese bakery. As a kid, I used to frequent the old Golden Carriage to grab a drink after a day at the park with my best friend. When I got to my mom's I check the place out on Yelp. Asked my son if he would be interested in trying Vegan food. He frowned until I convinced him by showing him the photos.\n\nNYC just opened their indoor dining again on the 14th. Temps were taken before we were allowed to sit down. Right off the bat, let me just say that our waiter was amazing, very attentive and kept asking how we liked everything. Decor-wise...I can't believe this is the same place, it's an amazing renovation.\n\nOne thing I read and saw was that their nachos w/chorizo is a must order. When it came to the table, I was like...no way we will finish that. Ummm, it was so frickin delish that we had no trouble. The first thing my son said was...I can't tell that it's Vegan and he's a huge meat eater. Our waiter asked if we wanted hot sauce with our nachos. He came by with 3 different ones and explained the level of hottest. The most mild one reminded me of a mole. I thought that was interesting.\n\nWe all enjoyed the tacos we ordered. The portions were generous and the ingredients fresh. I'm not familiar with Vegan cuisine but now I'm game to venture more into it. \n\nOn a last note: there is major gentrification that has been happening in the Lower East Side of Manhattan for years and I for one do welcome it. Some might argue about it but I think it makes the neighborhood more upscale."}],"aggregateRating":{"#type":"AggregateRating","ratingValue":4.5,"reviewCount":1078},"servesCuisine":"Mexican"}
</script>
How would I access something in this particular script tag and the json info inside of it using BeautifulSoup? Or is there a way to do it via the <a> tag with lxml and .find_all()?
You could use json module to parse content of script tags, which is accessible by .text field
Here is the example of parsing all script jsons and printing name:
import json
import requests
from bs4 import BeautifulSoup
url = 'https://www.yelp.com/biz/jajaja-plantas-mexicana-new-york-2?osq=Vegetarian+Food'
r = requests.get(
url,
headers={'User-Agent':'Mozilla/5.0'},
)
parsed_page = BeautifulSoup(r.text, 'html.parser')
page_jsons = []
for x in parsed_page.select('script[type="application/ld+json"]'):
try:
data = json.loads(x.text)
except:
continue
page_jsons.append(data)
for d in page_jsons:
if d.get('name'):
print(d['name']) # => Jajaja Plantas Mexicana
Is it possible to write my output tuple to a text file? I am using following code to get text between two strings as write them to a text file:
def format_file(file, start, end):
f = open('C:\TEMP\Test.txt', 'r').read()
return tuple(x for x in ''.join(f.split(start)).replace('\n', '').split(end) if x != '')
print (format_file('XYZ', 'Q2 2016 Apple Inc Earnings Call - Final', 'Event Brief of Q1 2016 Apple Inc Earnings Call - Final'))
file = open('C:\TEMP\out.txt', 'w')
file.write(format_file('XYZ', 'Q2 2016 Apple Inc Earnings Call - Final', 'Event Brief of Q1 2016 Apple Inc Earnings Call - Final'))
But I keep getting following error:TypeError: write() argument must be str, not tuple.
When I try to return output as a string instead of a tuple I get a blank file. I would really appreciate any help on this one.
here is my input file text:
Q2 2016 Apple Inc Earnings Call - Final
OPERATOR: From Piper Jaffray, we'll hear from Gene Munster.
GENE MUNSTER, ANALYST, PIPER JAFFRAY & CO.: Good afternoon. Tim, can you talk a little bit about the iPhone ASP trends, and specifically you mentioned that the SE is going to impact, but how are you thinking about the aspirational market share that's out there, and your actual market share, and using price to close that gap? Is it just the SE or could there be other iPhone models that will be discounted, to try to be more aggressive in emerging markets?
And one for Luca. Can you talk a little bit about the services segment, in terms of what piece of the services is driving growth, and maybe a little bit about the profitability on a net basis versus the growth basis that you have referred to in the past. Thanks.
TIM COOK: I think the SE is attracting two types of customers. One is customers that wanted the latest technology, but wanted it in a more compact package. And we clearly see even more people than we thought in that category.
Secondly, it's attracting people aspire to own an iPhone, but couldn't quite stretch to the entry price of the iPhone, and we've established a new entry. I think both of these markets are very, very important to us, and we are really excited about where it can take us. I do think that we will be really happy with the new to iPhone customers that we see from here, because of the early returns we've had. We are currently supply constrained, but we'll be able to work our way out of this at some point. But it's great to see the overwhelming demand for it. I will let Luca comment on the ASPs.
LUCA MAESTRI: On the ASPs, Gene we mentioned that we were going to be down sequentially, and this is really the combination of two factors. So when we go from the March quarter to the June quarter, is the fact that we are having the SE entering the mix, and that obviously is going to have a downward pressure on ASP, and also this channel inventory reduction that we have talked about, obviously the channel inventory reduction will come from higher-end models, and that is also affecting the sequential trend on ASPs.
The question on services, when we look at our services business, obviously growing very well across the board. The biggest element, and the part of the services business that is growing very well, we mentioned 35%, is the App Store. It's interesting for us that our music business, which had been declining for a number of quarters, now that we have both a download model and a streaming model, we have now hit an inflection point, and we believe that this would be the bottom, and we can start growing from there over time.
We have many other services businesses that are doing very well, we have an iCloud business that is growing very quickly. Faster than the App Store, from a much lower base but I think it's important for us as we continue to develop these businesses. Tim have talked about Apple Pay. It doesn't provide a meaningful financial contribution at this point, but as we look at the amount of transactions that go into Apple Pay right now, and we think ahead for the long-term, that could be an interesting business for us, as well.
From a profitability standpoint, we have mentioned last time that when you look at it on a gross basis, so in terms of purchase value of these services, the profitability of the business is similar to Company average. Of course, when you met out the amount that is paid to developers, and you look at it, in terms of what is reported in our P&L, obviously that business has a profitability that is higher than Company average. We don't get into the specifics of specific products or services, but it is very clear it is significantly higher than Company average.
GENE MUNSTER: Thank you.
NANCY PAXTON: Thanks, Gene. Could we have the next question please?
OPERATOR: Katy Huberty with Morgan Stanley.
KATY HUBERTY, ANALYST, MORGAN STANLEY: Yes, thank you. First for Luca. This is the worst gross margin guide in a year and a half or so, and over the last couple of quarters, you have talked about number of tailwinds including component cost, the lower accounting deferrals that went into effect in September. You just mentioned the services margins are above corporate average. So the question is, are some of those tailwinds winding down? Or is a significant guide down in gross margin for the June quarter entirely related to volume and the 5 SE? And then I have a follow-up for Tim.
LUCA MAESTRI: Katy, clearly the commodity environment remains quite favorable, and we continue to expect cost improvements. The other dynamics that you have mentioned are still there, obviously what is different, and particularly as we look at it on a sequential basis coming out of the March quarter, we would have loss of leverage, and that obviously is going to have a negative impact on margins. The other factor that's important to keep in mind is this different mix of products.
Particularly when you look at iPhone, what I was mentioning to Gene earlier, I think we've got a couple of things that are affecting not only ASPs, but obviously, they also affects margins. And it's the fact that we have a channel inventory reduction at the top end of the range, and we've got the introduction of the iPhone SE at the entry level of the range. And so when you take into account those factors, those are the big elements that drive our guidance range right now.
KATY HUBERTY: Okay. Thank you. And that a question for Tim, appreciate the optimism around longer-term iPhone unit growth, but with developed market penetration in anywhere from 60% to 80%, the growth is going to have to come from new markets. You talked about India. Could you just spend a little bit more time on that market? What are some of the hurdles you have to overcome, for that to be a larger part of the business? When we expect Apple to have more distribution, and specifically your own stores in that country? Thanks.
TIM COOK: Katy, in the short term, let me just make a couple of comments on the developed markets, just to make sure this is clear. If you look at our installed base of iPhone today versus two years ago, it's increased by 80%. When you think about upgrade cycles, upgrade cycles would have varying rates on it. As I talked about on the comments, the iPhone 6s rate, upgrade rate is slightly higher than the iPhone 5s, but lower than the iPhone 6.
But the other multiplier in that equation is obviously the size of the installed base. The net of the idea is that I think there's still really, really good business in the developed markets, so I wouldn't want to write those off. It's our job to come up with great products that people desire, and also to continue to attract over Android switchers. With our worldwide share there's still quite a bit of room in the developed markets, as well.
From an India point of view, if you look at India, and each country has a different story a bit, but the things that have held not only us back, perhaps, but some others as well, is that the LTE rollout with India just really begins this year. So we will begin to see some really good networks coming on in India. That will unleash the power and capability of the iPhone, in a way that an older network, 2.5G or even some 3G networks, would not do. The infrastructure is one key one, and the second one is building the channel out.
Unlike the US as an example, where the carriers in the US sell the vast majority of phones that are sold in the United States, in India, the carriers in general sell virtually no phones, and it is out in retail, and retail is many, many different small shops. We've been in the process. It's not something we just started in the last few weeks.
We've been working in India now for a couple of years or more, but we've been working with great energy over the last 18 months or so, and I am encouraged by the results that we're beginning to see there, and believe there's a lot, lot more there. It is already the third largest smart phone market in the world, but because the smart phones that are working there are low-end, primarily because of the network and the economics, the market potential has not been as great there. I view India as where China was maybe 7 to 10 years ago from that point of view. I think there's a really great opportunity there.
NANCY PAXTON: Thank you, Katy. Could we have the next question please?
OPERATOR: We will go to Toni Sacconaghi with Bernstein.
TONI SACCONAGHI, ANALYST, BERNSTEIN: I have one, and then a follow-up, as well. My sense is that you talked about adjusting for the changes in channel inventory, that you are guiding for relatively normal sequential growth. And I think if you do the math it's probably the same or perhaps a touch worse in terms of iPhone unit growth sequentially, relative to normal seasonality between fiscal Q2 and Q3. I guess the question is, given that you should be entering new markets and you should see pronounced elasticity from the SE device, why wouldn't we be seeing something that was dramatically above normal seasonal, in terms of iPhone revenues and units for this quarter?
Maybe you could push back on me, but I can't help thinking that when Apple introduced the iPad Mini in a similar move, to move down market, there was great growth for one quarter, and the iPad never grew again and margins and ASPs went down. It looks like you are introducing the SE, and at least on a sequential basis, you not calling for any uplift, even adjusting for channel inventory, and ASPs I presume will go down and certainly it's impacting gross margins as you've guided to. Could you respond to, A, why you're not seeing the elasticity, and B, is the analogy with the iPad mini completely misplaced?
TIM COOK: Toni, it's Tim. Let me see if I can address your question. The channel inventory reduction that Luca referred to, the vast, vast majority of that is in iPhone. That would affect the unit compare that you maybe thinking about. The iPhone SE, we are thrilled with the response that we've seen on it.
It is clear that there is a demand there, even much beyond what we thought, and so that is really why we have the constraint that we have. Do I think it will be like the iPad Mini? No, I don't think so. I don't see that.
I think the tablet market in general, one of the challenges with the tablet market is that the replacement cycle is materially different than in the smart phone market. As you probably know, we haven't had an issue in customer satisfaction on the iPad. It is incredibly high, and we haven't had an issue with usage of the iPad. The usage is incredibly high.
But the consumer behavior there is you tend to hold on for very long period of time, before an upgrade. We continue to be very optimistic on the iPad business, and as I have said in my remarks, we believe we are going to have the best compare for iPad revenue this quarter that we have quite some time. We will report back in July on that one, but I think iPhone has a particularly different kind of cycle to it than the tablet market.
TONI SACCONAGHI: Okay, and if I could follow-up, Tim. You alluded to replacement cycles and differences between the iPad and the iPhone. My sense was, when you were going through the iPhone 6 cycle, was that you had commented that the upgrade cycle was not materially different. I think your characterization was that it accelerated a bit in the US, but international had grown to be a bigger part of your business, and replacement cycles there were typically a little bit longer. I'm wondering if it was only a modest difference between the 5s and the 6, how big a difference are we really seeing in terms of replacement cycles across the last three generations, and maybe you could help us, if the replacement cycle was flat this year relative to what you saw last year, how different would your results have been this quarter in the first half?
TIM COOK: There's a lot there. Let me just say I don't recall saying the things that you said I said about the upgrade cycle, so let me get that out of the way. Now let me describe without the specific numbers, the iPhone 6s upgrade cycle that we have measured for the first half of this year, so the first six months of our fiscal year to be precise, is slightly better than the rate that we saw with the iPhone 5s two years ago, but it's lower than the iPhone 6. I don't mean just a hair lower, it's a lot lower.
Without giving you exact numbers, if we would have the same rate on 6s that we did 6, there would -- it will be time for a huge party. It would be a huge difference. The great news from my point of view is, I think we are strategically positioned very well, because we have announced the SE, we are attracting customers that we previously didn't attract. That's really great, and this tough compare eventually isn't the benchmark. The install base is up 80% over the last two years, and so all of those I think bode well, and the switcher comments I made earlier, I wouldn't underestimate that, because that's very important for us in every geography. Thanks for the question.
NANCY PAXTON: Thanks, Toni. Can we have the next question please?
OPERATOR: From Cross Research Group, we'll hear from Shannon Cross.
SHANNON CROSS, ANALYST, CROSS RESEARCH: I have a couple of questions. One, Tim, can you talk a bit about what's going on in China? The greater China revenue I think was down 26%. You did talk about mainland China, but if you could talk about some of the trends you're seeing there, and how you think it's playing out, and maybe your thoughts on SE adoption within China as well.
TIM COOK: Shannon, thanks for the question. If you take greater China, we include Taiwan, Hong Kong, and mainland China in the greater China segment that you see reported on your data sheet. The vast majority of the weakness in the greater China region sits in Hong Kong, and our perspective on that is, it's a combination of the Hong Kong dollar being pegged to the US dollar, and therefore it carries the burden of the strength of the US dollar, and that has driven tourism, international shopping and trading down significantly compared to what it was in the year ago.
If you look at mainland China, which is one that I am personally very focused on, we are down 11% in mainland China, on a reported basis. On a constant currency basis, we are only down 7%, and the way that we really look at the health or underlying demand is look at sell-through, and if you look at there, we were down 5%. Keep in mind that is down 5% on comp a year ago that was up 81%.
As I back up from this and look at the larger picture, I think China is not weak, as has been talked about. I see China as -- may not have the wind at our backs that we once did, but it's a lot more stable than what I think is the common view of it. We remain really optimistic on China. We opened seven stores there during the quarter.
We are now at 35. We will open 5 more this quarter to achieve 40, which we had talked about before. And the LTE adoption continues to rise there, but it's got a long way ahead of it. And so we continue to be really optimistic about it, and just would ask folks to look underneath the numbers at the details in them before concluding anything. Thanks for the question.
SHANNON CROSS: Thanks. My second question is with regard to OpEx leverage, or thinking about when I look at the revenue, your revenue is below our expectations but OpEx is pretty much in line. So how are you thinking about potential for leverage, cost containment, maybe when macro is bad and revenue is under pressure, and how are you juggling that versus the required investment you need to go forward?
LUCA MAESTRI: It is Luca. Of course, we think about it. We think about it a lot, and so when you look at our results, for example, our OpEx for the quarter, for the March quarter was up 10%, which is the lowest rate that you have seen in years. And when you look within OpEx, you actually see two different dynamics. You see continued significant investments in research and development, because we really believe that's the future of the Company.
We continue to invest in initiatives and projects ahead of revenue. We had a much broader portfolio that we used to have. We do much more in-house technology development than we used to do a few years ago, which we think is a great investment for us to make. And so that parts we didn't need to protect, and we want to continue to invest in the business, right?
And then when you look at our SG&A portion of OpEx for the March quarter, it was actually down slightly. So obviously we think about it, and of course we look at our revenue trends, and we take measures accordingly. When you look at the guidance that we provided for the June quarter, that 10% year-over-year increase that I mentioned to you for the March quarter goes down to a range of 7% to 9% up, and again, the focus is on making investments in Road and continuing to run SG&A extremely tightly, and in a very disciplined way.
As you know, our E2R, expense to revenue ratio, is around 10%. It's something that we are very proud of, it's a number that is incredibly competitive in our industry, and we want to continue to keep it that way. At the same time, we don't want to under-invest in the business.
SHANNON CROSS: Thank you.
NANCY PAXTON: Thank you, Shannon. Could we have the next question please?
OPERATOR: From UBS we hear from Steve Milunovich.
STEVE MILUNOVICH, ANALYST, UBS: Tim, I first wanted to ask you about services and how do you view services? You've obviously highlighted it the last two quarters. Do you view it going forward as a primary driver of earnings, or do you view it, and you mentioned platforms in terms of your operating systems, which I would agree with. In that scenario I would argue it's more a supporter of the ecosystem, and a supporter of the hardware margins over time, and therefore somewhat subservient to hardware. It's great that it's growing, but longer-term, I would view its role as more creating an ecosystem that supports the high margins on the hardware, as opposed to independently driving earnings. How do you think about it?
TIM COOK: The most important thing for us, Steve, is that we want to have a great customer experience, so overwhelmingly, the thing that drives us are to embark on services that help that, and become a part of the ecosystem. The reality is that in doing so, we have developed a very large and profitable business in the services area, and so we felt last quarter and working up to that, that we should pull back the curtain so that people could -- our investors could see the services business, both in terms of the scale of it, and the growth of it. As we said earlier, the purchase value of the installed base services grew by 27% during the quarter, which was an acceleration over the previous quarter, and the value of it hit -- was just shy of $10 billion. It's huge, and we felt it was important to spell that out.
STEVE MILUNOVICH: Okay, and then going back to the upgrades of the installed base, you have clearly mentioned that you've pulled forward some demand, which makes sense, but there does seem to be a lengthening of the upgrade cycle, particularly in the US. AT&T and Verizon have talked about that. Investors I think perceive that maybe the marginal improvements on the phone might be less currently, and could be less going forward. At the same time, I think you just announced that you can get the upgrade program online, which I guess potentially could shorten it. Do you believe that upgrade cycles are currently lengthening, and can continue to do so?
TIM COOK: What we've seen is that it depends on what you compare it to. If you compare to the 5s, what we are seeing is the upgrade rate today is slightly higher, or that there are more people upgrading, if you will, in a similar time period, in terms of a rate, than the 5s. But if you compare to 6, you would clearly arrive at the opposite conclusion. I think it depends on people's reference points, and we thought it very important in this call to be very clear and transparent about what we're seeing. I think in retrospect, you could look at it and say, maybe the appropriate measure is more to the 5s, and I think everybody intuitively thought that the upgrades were accelerated with the 6, and in retrospect, when you look at the periods, they clearly were.
STEVE MILUNOVICH: Thank you.
NANCY PAXTON: Thanks, Steve. Could we have our next question, please?
OPERATOR: We will go to Rod Hall with JPMorgan.
ROD HALL, ANALYST, JPMORGAN: Yes, thanks for fitting me in. I wanted to start with a general, more general question. I guess, Tim, this one is aimed at you. As you think about where you thought things were going to head last quarter, when you reported to us, and how it's changed this quarter, obviously it's kind of a disappointing demand environment. Can you just help us understand what maybe the top two or three things are that have changed? And so as we walk away from this, we understand what the differences are, and what the direction of change is? Then I have a follow-up.
TIM COOK: I think you're probably indirectly asking about our trough comment, if you will, from last quarter. And when we made that, we did not contemplate or comprehend that we were going to make a $2 billion-plus reduction in channel inventory during this quarter. So if you factor that in and look at true customer demand, which is the way that we look at internally, I think you'll find a much more reasonable comparison.
ROD HALL: Okay, great. Thank you. And then for my follow-up, I wanted to ask you about the tax situation a little bit. Treasury obviously has made some rule changes, and I wonder, maybe if Luca, you could comment on what the impact to Apple from those is, if anything? and Tim, maybe more broadly how you see the tax situation for Apple looking forward? Thanks.
LUCA MAESTRI: Yes, Rod, these are new regulations, and we are in the processing of assessing them. Frankly from first read, we don't anticipate that they are going to have any material impact on our tax situation. Some of them relate to inversion transactions, obviously that's not an issue for us. Some of them are around internal debt financing, which is not something that we use, so we don't expect any issue there.
As you know, we are the largest US taxpayer by a wide margin, and we already pay full US tax on all the profits from the sales that we make in the United States, so we don't expect them to have any impact on us on tax reform. I will let Tim continue to provide more color, but we've been strong advocates for comprehensive corporate tax reform in this country. We continue to do that. We think a reform of the tax code would have significant benefits for the entire US economy, and we remain optimistic that we are going to get to a point where we can see that tax reform enacted. At that point in time, of course, we would have much more flexibility around optimizing our capital structure, and around providing more return of capital to our investors.
TIM COOK: The only thing I would add, Rod, is I think there are a growing number of people in both parties that would like to see comprehensive reform, and so I'm optimistic that it will occur. It's just a matter of when and that's difficult to say. But I think most people do recognize that it is in the US's interest to do this.
ROD HALL: Great, thanks.
NANCY PAXTON: Thank you, Rod. A replay of today's call will be available for two weeks as a podcast on the iTunes Store, as webcast on Apple.com/investor and via telephone. And the numbers for the telephone replay are 888-203-1112, or 719-457-0820, and please enter confirmation code 7495552. These replays will be available by approximately 5:00 PM Pacific time today.
Members of the press with additional questions can contact Kristin Huguet at 408-974-2414, and financial analysts can contact Joan Hoover or me with additional questions. Joan is at 408-974-4570, and I am at 408-974-5420. Thanks again for joining us.
OPERATOR: Ladies and gentlemen, that does conclude today's presentation. We do thank everyone for your participation.
[Thomson Financial reserves the right to make changes to documents, content, or other information on this web site without obligation to notify any person of such changes.
In the conference calls upon which Event Transcripts are based, companies may make projections or other forward-looking statements regarding a variety of items. Such forward-looking statements are based upon current expectations and involve risks and uncertainties. Actual results may differ materially from those stated in any forward-looking statement based on a number of important factors and risks, which are more specifically identified in the companies' most recent SEC filings. Although the companies may indicate and believe that the assumptions underlying the forward-looking statements are reasonable, any of the assumptions could prove inaccurate or incorrect and, therefore, there can be no assurance that the results contemplated in the forward-looking statements will be realized.
THE INFORMATION CONTAINED IN EVENT TRANSCRIPTS IS A TEXTUAL REPRESENTATION OF THE APPLICABLE COMPANY'S CONFERENCE CALL AND WHILE EFFORTS ARE MADE TO PROVIDE AN ACCURATE TRANSCRIPTION, THERE MAY BE MATERIAL ERRORS, OMISSIONS, OR INACCURACIES IN THE REPORTING OF THE SUBSTANCE OF THE CONFERENCE CALLS. IN NO WAY DOES THOMSON FINANCIAL OR THE APPLICABLE COMPANY OR THE APPLICABLE COMPANY ASSUME ANY RESPONSIBILITY FOR ANY INVESTMENT OR OTHER DECISIONS MADE BASED UPON THE INFORMATION PROVIDED ON THIS WEB SITE OR IN ANY EVENT TRANSCRIPT. USERS ARE ADVISED TO REVIEW THE APPLICABLE COMPANY'S CONFERENCE CALL ITSELF AND THE APPLICABLE COMPANY'S SEC FILINGS BEFORE MAKING ANY INVESTMENT OR OTHER DECISIONS.]
LOAD-DATE: April 29, 2016
LANGUAGE: ENGLISH
TRANSCRIPT: 042616a5987433.733
PUBLICATION-TYPE: Transcript
Copyright 2016 CQ-Roll Call, Inc.
All Rights Reserved
Copyright 2016 CCBN, Inc.
4 of 9 DOCUMENTS
FD (Fair Disclosure) Wire
January 26, 2016 Tuesday
Event Brief of Q1 2016 Apple Inc Earnings Call - Final
and the output I am expecting is everthing between 'Q2 2016 Apple Inc Earnings Call - Final' and 'Event Brief of Q1 2016 Apple Inc Earnings Call - Final' in a text file.
Did your try converting your tuple into a string and writing to the file?
s = str('XYZ', 'Q2 2016 Apple Inc Earnings Call - Final', 'Event Brief of Q1 2016 Apple Inc Earnings Call - Final')
file.write(s)